Problem:
 Score : 200 points    Problem Statement 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 1 4
3      Sample Output 1 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 .       Sample Input 2 10
10      Sample Output 2 76  The value will be minimized when the operations are performed in the following order: A, A, A, A, B, B, B, B, B, B. In this case, the value will change as follows: 1 → 2 → 4 → 8 → 16 → 26 → 36 → 46 → 56 → 66 → 76 .  By the way, this contest is AtCoder Beginner Contest 076.

Solution (Python):












mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

def readInt():
    return list(map(int,input().split()))

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

if __name__=='__main__':
    main()

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

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

Solution (Python):


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

min_ans = -1

def dfs(n, count):
    global min_ans

    if count == N:
        if n < min_ans or min_ans < 0:
            min_ans = n
        return

    dfs(n * 2, count + 1)
    dfs(n + K, count + 1)

dfs(1, 0)
print(min_ans)

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

Solution (Python):
N = int(input())
K = int(input())

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

print(ans)

Solution (Python):
N = int(input())
K = int(input())
A = 1
for i in range(N):
  if A > K:
    A += K
  else:
    A *= 2
else:
  print(A)

Solution (Python):
n = int(input())
k = int(input())
ans = [1]
for i in range(n):
    if ans[i] < k:
        ans.append(2*ans[i])
    else:
        ans.append(ans[i] + k)
print(ans[n])

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

Solution (Python):
n = int(input())
k = int(input())
s = 1
for i in range(n):
  if s*2 > s+k:
    s +=k
  else:
    s *= 2

print(s)

Solution (Python):
n=int(input())
k=int(input())
ans=1

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

Solution (Python):
N = int(input())
K = int(input())
tmp = [2**(i+1)-2**i for i in range(10)]
t = 1
for i in range(N):
    if 2**i < K:
        t *= 2
    else:
        t += K
print(t)

Solution (Python):
N = int(input())
K = int(input())

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

print(ans)

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

Solution (Python):
n=int(input())
k=int(input())

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

Solution (Python):
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)

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

Solution (Python):
N = int(input())
K = int(input())

cnt = 0
val = 1
while cnt < N:
    if val <= K:
        val *= 2
    else:
        val += K
    cnt += 1

print(val)

Solution (Python):
N = int(input())
K = int(input())

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

print(sum)

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

Solution (Python):
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)

Solution (Python):
n = int(input())
k = int(input())
ans = 1

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

print(ans)

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
k = ii()

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

Solution (Python):
N = int(input())
K = int(input())
ans = 1

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

print(ans)

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

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

Solution (Python):
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)

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

Solution (Python):
import math
import string
import collections
from collections import Counter


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor



dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

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

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

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

Solution (Python):
n=int(input())
k=int(input())
cur=1
while n>0:
    if cur+k<=cur*2:
        cur+=k
    else:
        cur*=2
    n-=1
print(cur)

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

Solution (Python):

import sys


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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    solve(N, K)


if __name__ == '__main__':
    main()

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

Solution (Python):
n = int(input())
k = int(input())

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

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

print(ans)

Solution (Python):
N = int(input())
K = int(input())

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

Solution (Python):

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

def sousa(a, n, k):
	if(n==0): return a;
	else: return min(sousa(a*2,n-1,k), sousa(a+k,n-1,k))

print(sousa(1, N, K))

Solution (Python):

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

def sousa(a, n, k):
	if(n==0): return a;
	else: return min(sousa(a*2,n-1,k), sousa(a+k,n-1,k))

print(sousa(1, N, K))

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

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

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

Solution (Python):
n=int(input())
k=int(input())
ans=1

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

print(ans)

Solution (Python):
N=int(input())
K=int(input())
ans=1

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

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

Solution (Python):
n=int(input())
k=int(input())
x=1

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

Solution (Python):
def f(i):
    global m
    if i == n:
        c = 1
        for j in s:
            if j == 0:
                c *= 2
            else:
                c += k
        if m > c:
            m = c
        return
    f(i + 1)
    s[i] = 1
    f(i + 1)
    s[i] = 0

n = int(input())
k = int(input())
s = [0] * n
m = 114514
f(0)
print(m)

Solution (Python):
n = int(input())
k = int(input())
result = 1


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

Solution (Python):
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)

Solution (Python):
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)

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

Solution (Python):
n=int(input())
k=int(input())

ans = 1

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

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

Solution (Python):
N = int(input())
K = int(input())

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

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

Solution (Python):
n = int(input())
k = int(input())
x = 1
for i in range(n):
    x = min(x*2, x+k)

print(x)

Solution (Python):
N = int(input())
K = int(input())
sum = 1

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

print(sum)

Solution (Python):
def main():
    n = int(input())
    k = int(input())
    r = 1
    for i in range(n):
        r = min(r * 2, r + k)

    print(r)

if __name__ == '__main__':
    main()

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

Solution (Python):

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

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

Solution (Python):
n = int(input())
k = int(input())

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

print(ans)

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

Solution (Python):


import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

n, k = nin(2)

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

print(ans)

Solution (Python):

def main():
    import sys
    
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    
    from itertools import combinations, permutations
    
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    

    

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

if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
K=int(input())
answer=1
for a in range(N):
    if answer*2>=answer+K:
        answer+=K
    else:
        answer*=2
print(answer)

Solution (Python):








def resolve():

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

resolve()

Solution (Python):
N=int(input())
K=int(input())
count=1
for i in range(N):
  if count<K:
    count*=2
  else:
    count+=K

print(count)

Solution (Python):
N = int(input())
K = int(input())

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

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

Solution (Python):
n = int(input())
k = int(input())
now = 1
def a(n): return n * 2
def b(n): return n + k
for _ in range(n):
    now = min(a(now), b(now))
print(now)

Solution (Python):
N = int(input())
K = int(input())

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

print(num)

Solution (Python):
n, k = int(input()), int(input())


def rec(i, d):
    if i == n:
        return d
    return min(rec(i + 1, d + k), rec(i + 1, d * 2))


print(rec(0, 1))

Solution (Python):
N=int(input())
K=int(input())

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

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

Solution (Python):
N = int(input())
K = int(input())
 
def func(a):
  ans = 1
  for n in range(a):
    ans = ans*2
  for n in range(N-a):
    ans = ans + K
  return ans
 
print(min([func(i) for i in range(N+1)]))

Solution (Python):
N = int(input())
K = int(input())
x = 1
  
for i in range(N):
  if x < K:
    x = x*2
  else:
    x = x + K

print(x)

Solution (Python):

n = int(input())
k = int(input())
a = [1]

for i in range(n):
    if a[i] <= k:
        a.append(a[i] *2)
    else:
        a.append(a[i] + k)

print(a[-1])

Solution (Python):

n = int(input())
k = int(input())
a = [1]

for i in range(n):
    if a[i] <= k:
        a.append(a[i] *2)
    else:
        a.append(a[i] + k)

print(a[-1])

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
k = int(stdin.readline().rstrip())

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

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

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

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

Solution (Python):
N=int(input())
K=int(input())

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

Solution (Python):
N=int(input())
K=int(input())
ans=float('inf')
for i in range(2**N):
    bi=list(format(i,'b').zfill(N))
    now=1
    for b in bi:
        if b=='0':
            now*=2
        else:
            now+=K
    if now<ans:
        ans=now
print(ans)

Solution (Python):
n = int(input())
k = int(input())


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

print(val)

Solution (Python):

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

Solution (Python):


N = int(input().strip())
K = int(input().strip())


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

Solution (Python):
N = int(input())
K = input()
num = 1
ops = ["*2", "+" + K]

for _ in range(N):
    min = -1
    for op in ops:
        result = eval(str(num) + op)
        if min == -1 or result < min:
            min = result
    num = min

print(num)

Solution (Python):
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)

Solution (Python):
n=int(input())
k=int(input())
s=1

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

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

Solution (Python):
n = int(input())
k = int(input())

ans = 1

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

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

Solution (Python):
n = int(input())
k = int(input())
ans = 1

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

Solution (Python):


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

Solution (Python):
n = int(input())
k = int(input())

ans = 1

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

print(ans)

Solution (Python):
N, K = [int(input()) for i in range(2)]

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

print(v)

Solution (Python):
a = int(input())
b = int(input())
ans = 1
for _ in range(a):
    if ans < b:
        ans *= 2
    else:
        ans += b
print(ans)

Solution (Python):
N=int(input())
K=int(input())
a=[1,2]
for i in range(2,N+1):
    if a[i-1]<K:
        a.append(a[i-1]*2)
    else:
        a.append(a[i-1]+K)
print(a[N])

Solution (Python):
N = int(input())
K = int(input())

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

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

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

Solution (Python):
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)

Solution (Python):
N = int(input())
K = int(input())
ans = 1

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

print(ans)

Solution (Python):
n = int(input())
k = int(input())
ans = 1
while ans < k and n > 0:
  ans *= 2
  n -= 1
print(ans + k * n)

Solution (Python):

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

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

Solution (Python):
n = int(input())
k = int(input())
x = 1
i = 0
while i < n:
	i += 1
	x = min(2*x, k+x)
print (x)

Solution (Python):

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    K=I()
    ans=1
    for i in range(N):
        if ans<K:
            ans*=2
        else:
            ans+=K
    print(ans)
        

main()

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

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

Solution (Python):
n = int(input())
k = int(input())

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

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

Solution (Python):
n = int(input())
k = int(input())

def re_def(num, c, n=n, k=k):
    if c==n:
        return num
    for i in range(2):
        if i==0:
            num1 = re_def(num*2, c+1)
        else:
            num2 = re_def(num+k, c+1)
    return min([num1, num2])
print(re_def(1,0))

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

Solution (Python):
N = int(input())
K = int(input())
num = 1
for i in range(N):
    num += min(num, K)
print(num)

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

Solution (Python):
def main():
    n = int(input())
    k = int(input())
    score = 1
    for _ in range(n):
        score = min(score * 2, score + k)
    print(score)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n = int(input())
    k = int(input())
    score = 1
    for _ in range(n):
        if score < k:
            score *= 2
        else:
            score += k
    print(score)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
k = int(input())
x = 1

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

Solution (Python):
n = int(input())
k = int(input())
ans = 1
for _ in range(n):
    dn, dk = ans, k
    ans += min(ans, k)
print(ans)

Solution (Python):
def main():
    N = int(input())
    K = int(input())
    answer = 1
    for _ in range(N):
        if answer > K:
            answer += K
        else:
            answer *= 2
    print(answer)


if __name__ == '__main__':
    main()

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

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

Solution (Python):
def doubleork(n, k):

    ans = 1

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

    return ans


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


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
k = int(input())
ans = 1
for x in range(n):
    ans += min(ans, k)
print(ans)

Solution (Python):
n,k=[int(input()) for _ in range(2)]
num=1
for i in range(n):
    num_a=2*num
    num_b=num+k
    if num_a<num_b:
        num=num_a
    else:
        num=num_b
print(num)

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

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

Solution (Python):
n = int(input())
k = int(input())

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

Solution (Python):
n = int(input().strip())
k = int(input().strip())
ans = 1

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

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

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

Solution (Python):
n = int(input())
k = int(input())

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

print(r)

Solution (Python):
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)

Solution (Python):
N = int(input())
K = int(input())
i = 1
m = 1
while i <= N:
  if m < K:
    m = 2*m
  else:
    m += K
  i += 1
print(m)

Solution (Python):
n=int(input())
k=int(input())

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

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

Solution (Python):
N = int(input())
K = int(input())
i = 1

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

Solution (Python):
try:
    N = int(input())
    K = int(input())
    a = 1
    for i in range(N):
        if a*2<a+K:
            a = a*2
        else:
            a = a+K
    print(a)
except EOFError:
    pass

Solution (Python):
N=int(input())
K=int(input())
x=1
for i in range(N):
  if x>K:
    x+=K
  else:
    x*=2
print(x)

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

Solution (Python):




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


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
k = int(input())
ans = 1

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

print(ans)

Solution (Python):
N = int(input())
K = int(input())

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

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

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

Solution (Python):
n = int(input())
k = int(input())

point = 1

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

print(point)

Solution (Python):
n = int(input())
k = int(input())

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

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

Solution (Python):
n=int(input())
k=int(input())
i=0
while i<n and 2**i<=k:
    i+=1
print(2**i+k*(n-i))

Solution (Python):
n = int(input())
k = int(input())
ans = 1
count = 0
while ans < k:
  ans *= 2
  count += 1
  if count == n:
    print(ans)
    exit()
ans += k*(n-count)
print(ans)

Solution (Python):
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)

Solution (Python):
N = int(input())
K = int(input())
ans = 1

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

print(ans)

Solution (Python):
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)

Solution (Python):
N = int(input())
K = int(input())


ans = 1

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

Solution (Python):
n = int(input())
k = int(input())

ans = 1

for _ in range(n):
  a = ans * 2
  b = ans + k
  if a < b:
    ans = a
  else:
    ans = b
print(ans)

Solution (Python):
n = int(input())
k = int(input())

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

Solution (Python):
n = int(input())
k = int(input())
ans = 1

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

Solution (Python):
n = int(input())
k = int(input())

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

print(ans)

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

Solution (Python):
n=int(input())
k=int(input())
i=0
while i < n and 2**i<=k:
    i+=1
print(2**i+k*(n-i))

Solution (Python):
N = int(input())
K = int(input())
i = 1
for x in range(N):
  mod = i * 2 
  plus = i + K
  if mod > plus:
    i += K
  else:
    i = mod

print(i)

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

Solution (Python):
def main(N, K):
    
    res = 1
    for i in range(N):
        
        res = greedy(res, K)
    return res

def greedy(val, K):
    
    valA = val * 2
    valB = val + K
    return min(valA, valB)

N = int(input())
K = int(input())
print(main(N, K))

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

Solution (Python):
import sys

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

Solution (Python):
N = int(input())
K = int(input())
ans = 1

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

Solution (Python):
n =  int(input())
k = int(input())

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

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

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

Solution (Python):
n = int(input())
k = int(input())
tmp = 1
for i in range(n):
    tmp += tmp if tmp <= k else k

print(tmp)

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

Solution (Python):
n = int(input())
k = int(input())

def calc(tmp, kk):
    s1 = 2 * tmp
    s2 = tmp + kk
    if s1 < s2:
        tmp = s1
    else:
        tmp = s2
    return tmp

temp = 1
for i in range(n):
    temp = calc(temp, k)
print(temp)

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

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

Solution (Python):
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)

Solution (Python):
import math
import string

def intinput():
    return int(input())

def listintinput():
    return list(map(int,input().split()))

def splitintinput():
    return map(int,input().split())

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

print(ans)

Solution (Python):
n = int(input())
k = int(input())

d = 1

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

print(d)

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    k=INT()
    ct=1
    for i in range(n):
        ct=min(ct*2,ct+k)
    print(ct)
if __name__ == '__main__':
    do()

Solution (Python):
import math
N=int(input())
K=int(input())
count=1
for i in range(N):
    if (count+K)<=(count*2):
        count=count+K
    else:
        count=count*2
print(count)

Solution (Python):
n=int(input())
k=int(input())

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

Solution (Python):
n=int(input())
k=int(input())

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

Solution (Python):
n = int(input())
k = int(input())

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

print(x)

Solution (Python):
N = int(input())
K = int(input())
X = 1
for _ in range(N):
  X += X if X<K else K
print(X)