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

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

print(r)

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

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())
 
cnt = 0
ans = 1
while cnt < N:
    if ans*2 <= ans+K:
        ans *= 2
    else:
        ans += K
    cnt += 1
print(ans)

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

cnt = 0
ans = 1
while cnt < N:
    if ans*2 <= ans+K:
        ans *= 2
    else:
        ans += K
    cnt += 1
print(ans)

Solution (Python):
import math
N=int(input())
K=int(input())
P = int(math.log2(K)//1+1)
if P >= N:
    print(int(2**N))
else:
    a=int(2**P)
    a += (N-P)*K
    print(int(a))

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


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

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

v = 1
while v < k and n > 0:
    v = v*2
    n -= 1

for i in range(n):
    v += k

print(v)

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

Solution (Python):
import itertools
n = int(input())
k = int(input())
arr = ["plus","double"]
ans = []
tmp = 1

for i in itertools.product(arr,repeat=n):
    for j in i:
        if j == "double":
            tmp *= 2
        else:
            tmp += k
    ans.append(tmp)
    tmp = 1
print(min(ans))

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

Solution (Python):
n, k = int(input()), 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())
c = 0
r = 1
for i in [1, 2, 4, 8, 16]:
    if i <= k: c += 1
for i in range(n):
    if i <= (c-1):
        r *= 2
    else:
        r += k
print(r)

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

T=1

for i in range(N):
    T=T*2
    if T>K:
        break

for j in range(N-(i+1)):
    T+=K

print(T)

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

D = int(1)

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

print(D)

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

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=[0]*(n+1)
ans[0]=1
for i in range(1,n+1):
    ans[i]=min(ans[i-1]*2,ans[i-1]+k)
print(ans[-1])

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

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 = input()
K = input()
ans = 2**N
for i in range(2**N):
    v = 1
    for j in range(N):
        if i & (2**j) > 0:
            v *= 2
        else:
            v += K
    ans = min(ans, v)
print ans

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

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

def ev(bi):
    ret = 1
    for b in bi:
        if b == "0":
            ret *= 2
        else:
            ret += K
    return ret

INF = 100000000000000000
ans = INF
for i in range(N):
    bi = list(format(2 ** i - 1, "0{}b".format(N)))
    ans = min(ans, ev(bi))
print(ans)

Solution (Python):



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


def calc(a):
    if a <= k:
        a *= 2
    else:
        a += k
    return a


result = 1
for i in range(n):
    result = calc(result)


print(result)

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

ans = []

for i in range(N+1):
    ans.append(2**i+(N-i)*K)
    
print(min(ans))

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

X = 1

while N > 0:
    X *= 2
    N -= 1
    if X > K:
        break

X += K * N

print(X)

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

now = 1

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

print(now)

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

ans = 2**20
for mask in range(1<<n):
    t = 1
    for i in range(n):
        if (mask>>i)&1:
            t *= 2
        else:
            t += k
    ans = min(ans,t)

print(ans)

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

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

Solution (Python):
n = input()
k = input()
num = 1
b = lambda x, y: x+y if x > y else x*2
for _ in xrange(n):
    num = b(num, k)
print num

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

Solution (Python):
n = int(input())
a = int(input())
b = 1

for i in range(n):
    if b * 2 >= b + a:
        b += a
    else:
        b *= 2

print(b)

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

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 * 2 <= ans + k:
    ans = ans * 2
  else:
    ans += k

print(ans)

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

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

Solution (Python):


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

for i in range(N):
    if num <= K:
        num *= 2

    else:
        num += K

print(num)

Solution (Python):
N = int(input())
K = int(input())
x = 1
for i in range(N):
  if 2 * x < x + K:
    x *= 2
  else:
    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 = 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 = 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 = 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 = x + K
print(x)

Solution (Python):
x = int(raw_input())
y = int(raw_input())
d = 1
for i in range(0, x):
 if y > d:
  d += d
 else:
  d += y
print(d)

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

val = 1

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

print(val)

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

best = int(1e100)
for i in range(2**N):
    v = i
    v2 = 1
    for j in range(N):
        if (v % 2 == 0): v2 *= 2
        else: v2 += K
        v /= 2
    best = min(best, v2)
print(best)

Solution (Python):


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

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

print(D)

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 _ in range(N):
    add = a + K
    multi = a * 2
    if add > multi:
        a = multi
    else:
        a = add
print(a)

Solution (Python):


def main():
    N = int(input())
    K = int(input())
    
    ans = 1
    for _ in range(N):
        tmp1 = ans * 2
        tmp2 = ans + K
        if tmp1 > tmp2:
            ans = tmp2
        else:
            ans = tmp1
    print(ans)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
lis1 = [1]
lis2 = []
lis3 = []

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

for i in range(N):
	lis2.append(2*lis1[i])
	lis3.append(lis1[i] + K)
	if lis2[i] >= lis3[i] :
		lis1.append(lis1[i] + K)
		
	elif lis2[i] < lis3[i] :
		lis1.append(2*lis1[i])
		
print(lis1[N])

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

Solution (Python):
def addition_and_multiplication(N, K):
	initial = 1
	for i in range(N):
		if initial * 2 < initial + K:
			initial *= 2
		else:
			initial += K
	print(initial)


N = int(input())
K = int(input())
addition_and_multiplication(N, K)

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

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

if __name__ == '__main__':
    main()

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

Solution (Python):
a = int(input())
b = int(input())

n = 1

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

print(n)

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

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

print(res)

Solution (Python):
a = int(input())
b = int(input())
i = 0
p= 1
while i < a:
 if p > b:
  p = p+b
  i = i+1
 else:
  p = 2*p
  i = i+1
print(p)

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

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

print(ans)

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

n = 1
m = 0
while n < K and m < N:
    n *= 2
    m += 1
print(2 ** m + K * (N - m))

Solution (Python):
import sys


def main():

    
    args = _input_args()  

    
    result = _main(args)

    
    _output_result(result)


def _main(args):
    """Write Main Logic here for the contest.

    :param args: arguments
    :type args: list
    :return: result
    :rtype: depends on your logic.
    """
    
    N = int(args[0])
    K = int(args[1])

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

    
    return now


def _input_args():
    

    
    

    
    arguments = _get_args_from_multiple_lines(end_of_lines_char=[''], limit=2)

    
    

    return arguments  


def _input():
    
    return input()  


def _get_args_from_multiple_lines(end_of_lines_char=[''], limit=2):
    """Get arguments from multiple lines standard input.

    :param end_of_lines_char: Strings that indicate the end of lines.
    :type end_of_lines_char: list of str
    :param limit: If a number of the input line are certain, you can use this param to close prompt immediately.
    :type limit: int
    :return: args
    :rtype list of str
    """
    args = []
    for i in range(limit):
        try:
            arg = _input()
            if arg in end_of_lines_char:
                break
            args.append(arg)
        except EOFError:  
            break
    return args


def _output_result(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,K)
print(ans)

Solution (Python):
def calcA(x):
    return x*2

def calcB(k, x):
    return x + k

def main():
    n = int(input())
    k = int(input())
    start = 1
    for i in range(n):
        start1 = calcA(start)
        start2 = calcB(k, start)
        if start1 < start2:
            start = start1
        else:
            start = start2
    print(start)
main()

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")
 
 
def main():
    N = int(input())
    K = int(input())
    ans = INF
    for a in range(N + 1):
        b = N - a
        ans = min(ans, 2 ** a + b * K)
    print(ans)
 
 
if __name__ == '__main__':
    main()

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

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

ita = 1

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

    else:
        ita += K

print(ita)

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

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

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

a = 1

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

print(a)

Solution (Python):


if __name__ == "__main__":
    def A(now):
        return 2*now

    def B(now, K):
        return now + K

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

    for i in range(N):
        if A(now) < B(now, K):
            now = A(now)
        else:
            now = B(now, K)

    print(now)

Solution (Python):
a=input()
b=input()
c=1
for _ in xrange(a):
 c=min(c*2,c+b)
print c

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

for i in range(n):
    if x < k:
        x += x
    else:
        x += k

print x

Solution (Python):


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

num = 1
ans = 0
for i in range(1,N+1):
    A = 2 * num
    B = K + num
    ans = min(A,B)
    num = ans

print(ans)

Solution (Python):
n = int(input())
k = int(input())
num = 2**n
list = [format((i),"b").zfill(n) for i in range(num)]
result = []
for i in list:
    a = 1
    for j in range(n):
        if i[j] == "0":
            a *= 2
        else:
            a += k
    result.append(a)
print(min(result))

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

Solution (Python):


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

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

print(result)

Solution (Python):


def f(N, K):
    b = min(K.bit_length(), N)
    return 2**b + (N-b)*K


def test():
    assert f(4,3) == 10
    assert f(10,10) == 76


def main():
    N = int(input())
    K = int(input())
    print(f(N, K))


if __name__ == '__main__':
    main()

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

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


if __name__ == "__main__":
    main()

Solution (Python):

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

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

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

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

Solution (Python):
if __name__ == '__main__':
    N = int(input())
    K = int(input())

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

    print(num)

Solution (Python):

import itertools
N, K = (int(input()), int(input()))
num = 1
for tmp in range(N):
    a = 2*num
    b = num+K
    num = min(a,b)
print(num)

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

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(raw_input())
k=int(raw_input())
x=1
for i in xrange(n):
 if x*2<x+k:
  x*=2
 else:
  x+=k
print x

Solution (Python):
N = int(input())
K = int(input())
Ans = 1
def dowhich(x):
    if Ans*2 >= Ans+x:
        return Ans+x
    elif Ans*2 < Ans+x:
        return Ans*2
for _ in range(N):
    Ans = dowhich(K)

print(Ans)

Solution (Python):
a,b=int(input()),int(input())
ans=1
for i in range(a):
    ans=min(ans*2,ans+b)
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<<x)+k*(n-x) for x in range(n+1)]
print(min(a))

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

t = 1
for i in range(n):
	t = min(t+t, t+k)
print(t)

Solution (Python):
N = int(input())
K = int(input())
number = 1
while number < K and N>0:
    number = number*2 
    N = N-1
while number >= K and N>0:
    number = number+K
    N=N-1
print(number)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    N = int(input())
    K = int(input())
    ans = INF
    for a in range(N + 1):
        b = N - a
        ans = min(ans, 2 ** a + b * K)
    print(ans)


if __name__ == '__main__':
    main()

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

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):
n = int(input())
k = int(input())
min_t = 2**11

def dfs(pa,t):
    global min_t
    if t==n:
        min_t = min(min_t,pa)
        return
    dfs(pa+k,t+1)
    dfs(pa*2,t+1)

dfs(1,0)

print(min_t)

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())
a = 1
for _ in range(N):
  a = min(a+K, a*2)
print(a)

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

Solution (Python):


N = int(input())
K = int(input())
x = 1
n = 0
while x < K and n < N:
    x *= 2
    n += 1
while n < N:
    x += K
    n += 1
print(x)

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

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

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

print a

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

x = 1

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

print(x)

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

Solution (Python):
def operationA(num):
    number = num * 2
    return number


def operationB(num, k):
    number = num + k
    return number


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

for i in range(n):
    if start * 2 > start + k:
        start = operationB(start, k)

    else:
        start = operationA(start)


print(start)

Solution (Python):





from sys import stdin

def solve(N, K):
  x = 1
  for i in range(N):
    x = min(2 * x, x + K)
  return x

N = int(stdin.readline())
K = int(stdin.readline())
print(solve(N, K))

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

    total = 1
    for _ in range(N):
        hoge = total * 2
        fuga = total + K
        if hoge < fuga:
            total = hoge
        elif hoge >= fuga:
            total = fuga

    print(total)


if __name__ == "__main__":
    main()

Solution (Python):
N = 0
K = 0

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)

solve()

Solution (Python):
N=int(input())
K=int(input())
a=[1]
b=[]
for x in range(N):
    for i in a:
        b.append(i*2)
        b.append(i+K)
    a=b
    b=[]

print(min(a))

Solution (Python):
N=input()
K=input()
num = 1
for _ in range(N):
	A = num*2
	B = num+K
	num = A if A < B else B

print num

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

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

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

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

print(number)

Solution (Python):
N=int(input())
K=int(input())
a=[1]
b=[]
for x in range(N):
    for i in a:
        b.append(i*2)
        b.append(i+K)
    a=b
    b=[]

print(min(a))

Solution (Python):

D = 1
N = int(input())
K = int(input())
array =[1]

for i in  range(N):
	X = array[i]*2
	Z = array[i]+K
	if X >= Z:
		array.append(Z)
	else:
		array.append(X)

print(array[N])

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

x=1

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


print(x)

Solution (Python):


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

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

Solution (Python):
if __name__ == "__main__":
    n = int(input())
    k = int(input())

    result=1
    while(n!=0):
        if (result+k > result*2):
            result=result*2
        else:
            result=result+k
        n=n-1
    print(result)

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

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

Solution (Python):


n = int(raw_input())
k = int(raw_input())

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

print str(ans)

Solution (Python):
N = int(input())
K = int(input())
M = []
def dfs(num, k):
    if k == N:
        M.append(num)
    else:
        dfs(num + K, k + 1)
        dfs(num * 2, k + 1)
dfs(1, 0)
print(min(M))

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

m = 1
def f(m, n, k):
    if n==0:
        return m
    else:
        return min(f(m*2, n-1, k), f(m+k, n-1, k))

print(f(m, n, k))

Solution (Python):


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

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

if N > 0:
    for i in range(N):
        output_num += K

print(output_num)

Solution (Python):
import itertools
n = int(input())
k = int(input())
result = []
for seq in list(itertools.combinations_with_replacement([2, 1], n)):
    current = 1
    for i in seq:
        if i == 1:
            current += k
        else:
            current *= 2
    result.append(current)
print(min(result))

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

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

print(cur)

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

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

print(now)

Solution (Python):
import sys

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

curVal = 1
for i in range(0, N):
    if curVal < K:
        curVal = curVal + curVal
    else:
        curVal = curVal + K
print(curVal)

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

k = 1

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

print(k)

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

Solution (Python):


cnt = 1
cur = 1
n = int(input())
k = int(input())
while cnt <= n:
  cnt += 1
  opeA = cur * 2
  opeB = cur + k

  if opeA < opeB :
    cur = opeA
  else:
    cur = opeB
print (cur)

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

x = 1

for i in range(int(N)):
  y = int(int(x) * 2)
  z = int(int(x) + int(K))
  if int(y) <= int(z):
    x = y
  else:
    x = z

print(x)

Solution (Python):
import sys

num = 1
n = int(sys.stdin.readline().strip())
k = int(sys.stdin.readline().strip())

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

print(num)

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

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

print(S)

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

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

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

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):
def A(n,k):
    return 2*n
def B(n,k):
    return n+k
def square(n,k):
    a=A(c[0],k)
    b=B(c[0],k)
    i[0]-=1
    if i[0]==-1:
        return n
    else: 
        if a>=b:
            """
            print("A")
            print(a)
            print("B")
            print(b)
            """
            c[0]=b
            return square(c[0],k)
        else:
            """
            print("B")
            print(b)
            """
            c[0]=a
            return square(c[0],k)
c=[1]
n=int(input())
i=[n]
k=int(input())
print(square(n,k))

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

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

a = 1

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

print (a)

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

o=1
i=0

while o <=k and i <=n-1:
    o=o*2
    i+=1

while i <=n-1:
    o+=k
    i+=1

print(o)

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

ans = float("inf")




for i in range(2**N):
    curr_num = 1
    for _ in range(N):
        checker = i & 1
        if checker == 0:
            curr_num = curr_num * 2
        else:
            curr_num += K
        i >>= 1
    ans = min(ans, curr_num)
print(ans)

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

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

ans=1

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

Solution (Python):
n = int(raw_input())
k = int(raw_input())
s = 1
for x in xrange(n):
	if(  s*2-s < k):
		s = s*2
	else:
		s = s+k
print s

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

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

print(keiji)

Solution (Python):
def B_Addition_and_Multiplication(N, K):
    if N==1:
        return 2
    multiply = 0  
    add = 0  
    tmp = 1
    while tmp < K:
        tmp *= 2
        multiply += 1
    add = N - multiply

    ans = pow(2, multiply) + K * add
    return ans
  
N = int(input())
K = int(input())
print(B_Addition_and_Multiplication(N, K))

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

print(p)

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

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

    print(v)

if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
K=int(input())
result=[2**i+K*(N-i) for i in range(N+1)]
print(min(result))

Solution (Python):
N = int(input())
K = int(input())
ans = []

def DFS(num=1, cnt = 1):
    
    if cnt==N+1:
        ans.append(num)
        return False
        
    if DFS(num*2, cnt+1):
        return True
    
    if DFS(num+K, cnt+1):
        return True

DFS()
print(min(ans))

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

Solution (Python):
def bin(a):
  return 2*a

def ten(a):
  return a+K

N = int(input())
K = int(input())
value = 1
for i in range(N):
  if bin(value) <= ten(value) :
    value = bin(value)
  else:
    value = ten(value)
print(value)

Solution (Python):

import sys, re, copy, math, itertools
from copy import *
from collections import deque, defaultdict
from heapq import *
from bisect import *




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

min_x = 2147483647 // 2

for A in range(N):
    x = 1
    for a in range(A):
        x *= 2
    for b in range(N-A):
        x += K
    
    if x < min_x:
        min_x = x

for B in range(N):
    x = 1
    for b in range(B):
        x += K
    for a in range(N-B):
        x *= 2
    
    if x < min_x:
        min_x = x

print(min_x)

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

x=1

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

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

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

print(min)

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

Solution (Python):

if __name__ == '__main__':
    N = input()
    K = input()
    result = 2**N
    for i in range(N):
        result = min(result, 2**i + K * (N - i))
    print result

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

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

x = 1

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

print x

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)