Square1001 has seen an electric bulletin board displaying the integer 1.
He can perform the following operations A and B to change this value:
 - Operation A: The displayed value is doubled.
 - Operation B: The displayed value increases by K.
Square1001 needs to perform these operations N times in total.
Find the minimum possible value displayed in the board after N operations.

-----Constraints-----
 - 1 \leq N, K \leq 10
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:
N
K

-----Output-----
Print the minimum possible value displayed in the board after N operations.

-----Sample Input-----
4
3

-----Sample Output-----
10

The value will be minimized when the operations are performed in the following order: A, A, B, B.

In this case, the value will change as follows: 1 → 2 → 4 → 7 → 10.

Difficulty: introductory

Starter code:

Solutions:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**6)

n = int(input())
k = int(input())

ans = 1
for i in range(n):
    if ans*2 <= (ans+k):
        ans *= 2
    else:
        ans += k
    # print(ans)
print(ans)


N = int(input())
K = int(input())

value = 1

for i in range(N):
  if(value * 2 <= value + K):
    value = value * 2
  else:
    value = value + K

print(value)

n = int(input())
k = int(input())

cnt = 1
for _ in range(n):
    cnt = min(cnt*2, cnt+k)
print(cnt)

N = int(input())
K = int(input())
ans = 1
for _ in range(N):
    if ans * 2 <= ans + K:
        ans *= 2
    else:
        ans += K
print(ans)


n=int(input())
k=int(input())
ans=1
for _ in range(n):
    if(ans*2 < ans+k):
        ans=ans*2
    else:
        ans=ans+k
        
print(ans)

N = int(input())
K = int(input())

start = 1

for n in range(N):
    start = min(start*2, start+K)

print(start)


N = int(input())
K = int(input())

ans = 1
for _ in range(N):
    ans = min(ans * 2, ans + K)
print(ans)

a=int(input())
b=int(input())
c=1
for i in range(a):
  if 2*c<=c+b:
    c=2*c
  else:
    c=c+b
print(c)

N = int(input())
K = int(input())

ans = 1
for _ in range(N):
  ans = min(ans*2,ans+K)
print(ans)

n = int(input())
k = int(input())
ref = 1

for i in range(n):
  if ref * 2 < ref + k:
    ref *= 2
  else:
    ref += k

print(ref)

n=int(input())
k=int(input())
dis = 1
for i in range(n):
    if dis*2 <= dis+k:
        dis *= 2
    else:
        dis += k
print(dis)

n = int(input())
k = int(input())

tmp = 1
for i in range(n):
    tmp = min(tmp * 2, tmp + k)
print(tmp)


n = int(input())
k = int(input())
a = 1
for i in range(n):
    if a <= k:
        a *= 2
    else:
        a += k
print(a)

n = int(input())
k = int(input())
a = 1
for i in range(n):
  a = min(2*a,a+k)
print(a)

N=int(input())
K=int(input())

ans=1
for i in range(N):
    if ans<=K:
        ans*=2
    else:
        ans+=K

print(ans)

N=int(input())
K=int(input())
start=1
for i in range(N):
    start_a=start*2
    start_b=start+K
    if start_a<=start_b:
        start=start_a
    else:
        start=start_b

print(start)

# -*- coding: utf-8 -*-
n = int(input())
k = int(input())
ans = 1
for i in range(n):
    ans = min(ans*2, ans+k)

print(ans)


n = int(input())
k = int(input())
c = 1
for i in range(n):
  if c > k:
    c += k
  else:
    c *= 2
print(c)

N,K = [int(input()) for _ in range(2)]

ans = 1

for _ in range(N):ans = min(ans+K,ans*2)

print(ans)


N = int(input())
K = int(input())
ans = 1
for i in range(N):
    ans = min(ans*2, ans+K)
print(ans)


n = int(input())
k = int(input())
num = 1

for i in range(n):
    num = min(num + k, num * 2)
    
print(num)

N = int(input())
K = int(input())

ans = 1

def A(n):
   return 2 * n

def B(n):
   return n + K

for i in range(N):
   if A(ans) <= B(ans):
      ans = A(ans)
   else:
      ans = B(ans)

print(ans)

n=int(input())
k=int(input())
a=1
for _ in range(n):
  if a<k:
    a*=2
  else:
    a+=k
print(a)

n = int(input())
k = int(input())

x = 1
for i in range(n):
    x = min(x * 2, x + k)
print(x)


n = int(input())
k = int(input())

ans = 1
for i in range(n):
    if ans >= k:
        ans += k
    else:
        ans *= 2
print(ans)

n=int(input())
k=int(input())
ans=1
for _ in range(n):
  if ans<k:ans*=2
  else:ans+=k
print(ans)

n,k=int(input()),int(input());a=1
while a<=k:
  if n==0:
    print(a)
    return
  a*=2
  n-=1
while n>0:
  a+=k
  n-=1
print(a)

n=int(input())
k=int(input())
given_integer=1
#Option A:-To Increase The Value By double
#Option B:-To Increase Value By K

for i in range(0,n):
	given_integer=min(given_integer*2,given_integer+k)

print((int(given_integer)))


n,k = int(input()),int(input())
# Greedy
ans = 1
for i in range(n):
    ans = min(ans+k, ans*2)
print(ans)

n = int(input())
k = int(input())
ans = 1
for _ in range(n):
    if ans < k:
        ans *= 2
    else:
        ans += k
print(ans)


n = int(input())
k = int(input())

cnt = 1
tmp = 0
for i in range(n):
    cnt = min(cnt*2, cnt + k)
print(cnt)

n = int(input())
k = int(input())
ans = 1
for i in range(n):
  ans = min(ans*2,ans+k)
print(ans)

n, k = [int(input()) for _ in range(2)]

result = 10 ** 9

for bit in range(2 ** n):
  
  tmp = 1
  for i in range(n):
    if bit & (1 << i):
      tmp *= 2
    else:
      tmp += k
  
  result = min(result, tmp)
  
print(result)

n=int(input())
k=int(input())
a=1
for i in range(n):
  if a<=k:
    a*=2
  else:
    a+=k

print(a)

n, k = (int(input()) for i in range(0, 2))
ans = 1
for i in range(0, n):
    if ans * 2 <= ans + k: ans *= 2
    else: ans += k
print(ans)

n,k = [int(input()) for i in range(2)]

number=1

for i in range(n):
    number = min(2*number, number+k)
print(number)

n = int(input())
k = int(input())
ans = 1
for _ in range(n):
    if ans * 2 > ans + k:
        ans += k
    else:
        ans *= 2
print(ans)

N = int(input())
K = int(input())

res = 1
for i in range(N):
    if(K >= res):
        res *= 2
    else:
        res += K
print(res)


n = int(input())
k = int(input())
num = 1
for i in range(n):
    if num*2 <= num+k:
        num *= 2
    else:
        num += k

print(num)

n = int(input())
k = int(input())

a = 1
for i in range(n):
    if a <= k:
        a *= 2
    else:
        a += k
print(a)

N = int(input())
K = int(input())
X = 1
for i in range(N):
    if X<K:
        X += X
    else:
        X += K

print(X)


# coding: utf-8
import math

ans = 1
count = 0
num1 = int(input())
num2 = int(input())
for i in range(num1):
    if ans < num2:
        ans *= 2
    else:
        ans += num2
print(ans)

ans=float('inf')
n,k=int(input()),int(input())
for i in range(2**n):
    ans=min(ans,eval('('*n+'1'+"".join('*2)'if (i>>j)%2 else '+'+str(k)+')' for j in range(n))))
print(ans)

n = int(input())
k = int(input())
a = 1
for i in range(n):
    if a<k:
        a = a*2
    else:
        a+=k
print(a)

n = int(input())
k = int(input())
x = 1
for i in range(n):
  if x + k <= 2*x:
    x += k
  else:
    x *= 2
print(x)

N = int(input())
K = int(input())

start = 1
for i in range(N):
  start = min(start * 2, start + K)

print(str(start))

N = int(input())
K = int(input())
j = 1
def func(x, y):
    r = (x * 2) if (x * 2) < (x + y) else  (x + y)
    return r

for i in range(N):
    j = func(j, K)
print(j)

n = int(input())
k = int(input())

ans = 1

for i in range (0 , n):
    ans = min(2 * ans, ans + k)
print(ans)

n = int(input())
k = int(input())
numb = 1
for i in range(n):
    if 2*numb < numb+k:
        numb *= 2
    else:
        numb += k
print(numb)

N=int(input())
K=int(input())
x=1
for _ in range(N):
    x=min(2*x,x+K)
print(x)


N = int(input())
K = int(input())

out =  1
flg = 0
for i in range(N):#Aの回数を数えるためのループ
    if not flg:#フラグが立ってなかったら操作A
        out *= 2
        if out > K:
            flg = 1
    else:#フラグが立ったら操作B
        out += K

print(out)

def main():
    n = int(input())
    k = int(input())

    ans = 1
    for i in range(n):
        ans = min(2*ans, ans+k)
    print(ans)


main()

n=int(input())
k=int(input())
s=1
for i in range(n):
  s=min(s*2,s+k)
print(s)

N=int(input())
K=int(input())
ans=1000
for i in range(N+1):
    num=1
    for s in range(i):
        num = num*2
    
    for t in range(N-i):
        num += K
    
    if num < ans:
        ans = num

print(ans)

#76B
n=int(input())
k=int(input())
f=1
for i in range(0,n):
    if f*2<f+k:
        f=f*2
    else:
        f=f+k
print(f)

n,k=int(input()),int(input())
ans=1
i=0
while i!=n:
    if ans>=k:
        ans+=k
    else:
        ans*=2
    i+=1
print(ans)

#!/usr/bin/env python3

N = int(input())
K = int(input())

ans = 1
for i in range(N):
    a = ans * 2
    b = ans + K
    ans = min(a, b)
print(ans)


N=int(input())
K=int(input())
a=1
for i in range(N):
  if a < K:
    a *= 2
  else:
    a += K
print(a)

N = int(input())
K = int(input())

x = 1
for _ in range(N):
  x += min(x, K)

print(x)

n, k = [int(input()) for i in range(2)]
a = 1
for i in range(n):
  if a * 2 > a + k:
    a += k
  else:
    a *= 2
print(a)

n,k = int(input()),int(input())
ans = 1
for i in range(n):
    ans = min(ans+k,ans*2)
print(ans)


n = int(input())
k = int(input())

ans = 1

for i in range(n):
    ans = min(ans*2, ans+k)

print(ans)

N = int(input())
K = int(input())
start = 1
for i in range(N):
    start = min(start*2, start+K)
print(start)

def answer(n: int, k: int) -> int:
    current_num = 1
    for _ in range(n):
        current_num = min(current_num * 2, current_num + k)

    return current_num


def main():
    n =int(input())
    k = int(input())
    print((answer(n, k)))


def __starting_point():
    main()

__starting_point()

n = int(input())
k = int(input())

res = 1
for i in range(n):
    if res >= k:
        res += k
    else:
        res *= 2
print(res)


N=int(input())
K=int(input())

#A+B=N
#A:C[i]*2 
#B:C[i]+K
  
C=1
for i in range(N):
  if C*2>C+K:
    C=C+K
  else:
    C=C*2
    
print(C)
  



def solve():
    n = int(input())
    k = int(input())
    ans = 1
    for i in range(n):
        if ans < k:
            ans *= 2
        else:
            ans += k

    print(ans)


def __starting_point():
    solve()

__starting_point()

n = int(input())
k = int(input())
 
num = 1
count = 0
 
while count < n:
    num = min(num * 2, num + k)
    count += 1
  
print(num)

n = int(input())
k = int(input())

ans = 1
for r in range(n):
    if ans <= k:
        ans *= 2
    else:
        ans += k

print(ans)

N = int(input())
K = int(input())
init = 1
for i in range(N):
    init = min(init*2, init + K)
print(init)

N = int(input())
K = int(input())

a = 1
for _ in range(N):
    if a*2 < a+K:
        a *= 2
    else:
        a += K
print(a)

n=int(input())
k=int(input())

num=1
for i in range(n):
  num=min(num*2,num+k)

print(num)

n=int(input())
k=int(input())
ans=1
for i in range(n):
    if ans<k:
        ans*=2
    else:
        ans+=k
print(ans)

N = int(input())
K = int(input())

ans = 1
for _ in range(N):
    if ans + K < 2 * ans:
        ans += K
    else:
        ans *= 2
print(ans)

n = int(input())
k = int(input())
i=1
for _ in range(n):
    i = i+min(i,k)
print(i)

n=int(input())
k=int(input())

from itertools import product

pr = list(product([0,1],repeat=n))

ans=float('inf')
for p in pr:

    tmp=1
    for i in p:
        if i==0:
            tmp*=2
        else:
            tmp+=k

    ans= min(ans,tmp)


print(ans)



n = int(input())
k = int(input()) 
mn = 1
for i in range(n):
    if mn + k  <= mn *2:
      mn += k
    else:
      mn = mn * 2
print(mn)


N = int(input())
K = int(input())
s = 1
for _ in range(N):
    s = min(s * 2, s + K)
print(s)

n = int(input())
k = int(input())

cnt = 1
for _ in range(n):
    if cnt <= k:
        cnt *= 2
    else:
        cnt += k
print(cnt)

N = int(input())
K = int(input())

ans = float("inf")
for i in range(N+1):
  num = 1 * (2 ** i) + K * (N - i)
  ans = min(ans, num)
  
print(ans)

from functools import reduce

def operator(x, K, N):
    res = (lambda x: 2*x if x < K else x+K)(x)
    return res if N == 1 else operator(res, K, N-1)

def main():
    with open(0) as f:
        N, K = list(map(int, f.read().split()))
    ans = operator(1, K, N)
    print(ans)

main()    


N = int(input())
K = int(input())
ans = 1
for i in range(N):
    ans = min(2*ans,ans+K)
print(ans)

N = int (input ())
K = int (input ())
s = 1
for i in range (N):
  if s < K:
    s = s*2
  else:
    s += K
print (s)

N = int(input())
K = int(input())
a = 1
for _ in range(N):
    a = min(a*2, a+K)
print(a)

N = int(input())
K = int(input())
x = 1
for _ in range(N):
	x = min(x * 2, x + K)
print(x)

n = int(input())
k = int(input())
ans = 1
for _ in range(n):
  ans = min(ans*2, ans+k)
print(ans)

N = int(input())
K = int(input())
display = 1

for i in range(N):
    display = min(display*2, display + K)
print(display)


n = int(input())
k = int(input())

ans = 1
for i in range(n):
  ans = min(ans * 2, ans + k)
  
print(ans)

import sys

input = sys.stdin.readline
N = int(input())
K = int(input())

c = 0
tmp = 1
while c < N:
    if tmp < K:
        tmp *= 2
    else:
        tmp += K
    c += 1
    # print(tmp)

print(tmp)

a = int(input())
b = int(input())
x = 1
for i in range(a):
    if x + b > x * 2:
        x = x * 2
    else:
        x = x + b
print(x)

n,k=int(input()),int(input());a=1
for _ in range(n): a=min(2*a,k+a)
print(a)

N=int(input())
K=int(input())
res=1
for i in range(N) :
  if res*2<=res+K :
    res*=2
  else :
    res+=K
print(res)

n = int(input())
k = int(input())
ans = 1
for i in range(n):
    ans = min(ans*2,ans+k)
print(ans)

n=int(input())
k=int(input())
ans=1
for i in range(n):
    ans=min(ans+k,ans*2)
print(ans)

N=int(input())
K=int(input())
now=1
for i in range(N):
    now=min(now*2,now+K)
print(now)

n = int(input())
k = int(input())
c = 1
for i in range(n):
  c = min(2*c, c+k)
print(c)

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    K = I()

    ans = 1
    while ans < K and N > 0:
        ans *= 2
        N -= 1
    ans += N * K

    print(ans)

def __starting_point():
    resolve()

__starting_point()

N = int(input())
K = int(input())
ans = 1

for i in range(N):
  if ans > K:
    ans += K
  else:
    ans *= 2
print(ans)


N = int(input())
K = int(input())
v = 1
for _ in range(N):
    if v <= K:
        v *= 2
    else:
        v += K
print(v)

n=int(input())
k=int(input())
ans=1
for i in range(n):
  if ans*2 >= ans+k:
    ans=ans+k
  else:
    ans=ans*2
print(ans)