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

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

while N > 0:
  tmp1 = cur + K
  tmp2 = cur * 2
  cur = min(tmp1, tmp2)
  N -= 1

print(cur)

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

l = [1]
for _ in range(n):
    l.append(min(l[-1] * 2, l[-1] + k))

print(l[-1])

Solution (Python):
mini = 1025
N = int(input())
K = int(input())
for i in range(N+1):
  x = 1
  xx = 2**i
  xxx = K*(N-i) +xx
  
  if xxx < mini:
    mini = xxx
print(mini)

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

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

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

Solution (Python):
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext

def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    k = i_input()

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

    print(num)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
s = input()
v = input()

n = int(s)
k = int(v)

x = 1

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

Solution (Python):
N = int(input())
K = int(input())
 
ans = 1000000
 
for bi in range(1<<N):
  cnt = 1
  for i in range(N):
    if bi>>i&1:
      cnt *= 2
    else:
      cnt += K
  ans = min(ans, cnt)
print(ans)

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

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

Solution (Python):
def main():
    n = int(input())
    k = int(input())
    
    tmp = 1
    i=0
    while(i<n):
        if(tmp < k):
            tmp += tmp
        else:
            tmp += k
        i+=1
    print(tmp)
if __name__ == '__main__':
    main()

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

i = 0
ans = 1
while True:
    if i == N:
        break
    if ans < K:
        ans *= 2
        i += 1
    else:
        ans += K
        i += 1

print(ans)

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

Solution (Python):
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

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

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

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

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

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

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

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

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

res = float('inf')
for i in range(n+1):
    num = 1
    for c in range(n):
        if c < i:
            num *= 2
        else:
            num += k
    res = min(res, num)

print(res)

Solution (Python):
def actual(N, K):
    
    op_A = lambda i: i * 2
    op_B = lambda i: i + K

    num = 1

    for _ in range(N):
        num = min(op_A(num), op_B(num))

    return num

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

Solution (Python):
import itertools


def actual(N, K):
    op_A = lambda i: i * 2
    op_B = lambda i: i + K

    patterns = list(itertools.product((op_A, op_B), repeat=N))

    results = []

    for pattern in patterns:
        num = 1

        for op in pattern:
            num = op(num)

        results.append(num)

    return min(results)

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

print(actual(N, K))

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

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

Solution (Python):

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

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

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

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

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

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


ans = 100000001
for i in range(1<<n):
    tmp = 1
    
    for j in range(n):
        if (i>>j) & 1:
            tmp *= 2
        else:
            tmp += k
    
    ans = min(ans, tmp)

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):
  ans = min(ans*2,ans+k)
print(ans)

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

ans = 1
for _ 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 = []
for i in range(1<<N):
    res = 1
    for j in range(N):
        if (1 & (i >> j)):
            res = res*2
        else:
            res = res + K
    ans.append(res)

print(min(ans))

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

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

print(ans)

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

if __name__ == '__main__':
    main()

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

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

Solution (Python):

import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


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

print(ans)

Solution (Python):
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n = I()
k = I()
ans = INF
for i in range(2 ** n):
    res = 1
    for j in range(n):
        if i >> j & 1:
            res *= 2
        else:
            res += k
    ans = min(ans, res)
print(ans)

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

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

print(p)

Solution (Python):
n, k = int(input()), 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 += k
    else:
        ans *= 2
print(ans)

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

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

print(result)

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

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

print(answer)

Solution (Python):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

def solve(n):
    if n == N:
        return 1

    v = solve(n + 1)
    return min(v * 2, v + K)

print(solve(0))

Solution (Python):
import math;n,k=int(input()),int(input());c=int(math.log2(k))+1;d=min(n,c);print(2**d+(n-d)*k)

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

def ope_a(num_local):
    num_local = 2 * num_local
    return num_local

def ope_b(x):
    x = x + k
    return x

i = 0
while i < n:
    if ope_a(num) <= ope_b(num):
        num = ope_a(num)
        i += 1
    else:
        num = ope_b(num)
        i += 1

print(num)

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

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

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

if not ( 1 <= N <= 10 and 1 <= K <= 10 ):
    sys.exit()

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

print(start)

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

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

Solution (Python):
N = int(input())
K = int(input())
num = 1
while N>0:
  if num > K:
    num += K
  else:
    num *=2
  N-=1
print(num)

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

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

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

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):
n=int(input())
k=int(input())
a=1
for n in range(n):
  a+=min(a,k)
print(a)

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

for n in range(N):
  a+=min(a,K)

print(a)

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

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

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):
def mi():
    return map(int, input().split())

def ii():
    return int(input())

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

if __name__ == '__main__':
    main()

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

print(p)

Solution (Python):
from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy


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


def gcd(a, b):
    while(b != 0):
        a, b = b, a % b
    return a



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

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

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

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

print(ans)

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

print(result)

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

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

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

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

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

print(a)

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

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

Solution (Python):
from math import log2
n = int(input())
k = int(input())
temp = min(int(log2(k)) + 1, n)
print(2 ** temp + k * (n - temp))

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

Solution (Python):
import sys

input = sys.stdin.readline


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

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

    print(ans)


if __name__ == "__main__":
    main()

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):
N=int(input()) 
K=int(input()) 

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

print(num)

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

i = 0
ans = 1
while True:
    if i == n:
        print (ans)
        exit ()
    else:
        i += 1
        if ans*2 < ans+k:
            ans *= 2
        else:
            ans += k

Solution (Python):
if __name__ == '__main__':
    n =int(input())
    k =int(input())
    count =1

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

    print(count)

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

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

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

Solution (Python):
N,K=int(input()),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())
cur_val=1
for i in range(0,N):
  cur_val=min(cur_val*2,cur_val+K)
print(cur_val)

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

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

c=0
x=1
for i in range(n):
    if x>k:
        break
    else:
        x=x*2
        c+=1
for j in range(n-c):
    x+=k

print(x)

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):
    ans = min(ans*2, ans+K)
print(ans)

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

tmp=1
num=1
while n>0:
    if tmp<k:
        num*=2
        tmp*=2
    else:
        num+=k
    n-=1

print(num)

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

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

i = 0
m = 1
while True:
  if m < k:
    m = m*2
    i += 1
  else:
    break
    
if i <= n :
  print(2**i + k * (n-i))
else :
  print(2**n)

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

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

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 < K:
    a *= 2
  else:
    a += K
print(a)

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 i in range(N):
  ans=min(ans+K,ans*2)
print(ans)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

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



if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
k = int(input())
tmp = 1
i = 0
while True:
  a = 0
  b = 0
  if i == n:
    break
  else:
    a = tmp * 2
    b = tmp + k
    tmp = min(a,b)
    
    i += 1
print(tmp)

Solution (Python):
N = int(input())
K = int(input())
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
while n > 0:
    a = ans * 2;
    b = ans + k
    ans = min(a, b)
    n -= 1

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):
    multi=ans*2
    add=ans+k
    ans=min(multi,add)
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 = 1000000000000
for i in range(2 ** N):
    num = 1
    for j in range(N):
        if i & (1 << j):
            num *= 2
        else:
            num += K
    ans = min(ans, num)
print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10**7) 
import math
from copy import copy, deepcopy
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right

from collections import deque


from collections import Counter

from itertools import accumulate

from heapq import heapify,heappop,heappush


from functools import lru_cache


def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 10**9+7
    

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

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



if __name__ == "__main__":
    main()

Solution (Python):
from itertools import combinations_with_replacement

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


def times_two(n):
    return 2 * n


def plus_k(n):
    return n + K


ans = []
for funcs in combinations_with_replacement((times_two, plus_k), N):
    value = 1
    for func in funcs:
        value = func(value)
    ans.append(value)
print(min(ans))

Solution (Python):
from itertools import product

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

li = [0,1]

lin = list(product(li, repeat=n))
mi = 10**18

for i in lin:
    point = 1
    for j in i:
        if j == 0:
            point *= 2
        else:
            point += k
    mi = min(point,mi)

print(mi)

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):
def main():
    N, K = (int(input()) for _ in range(2))

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

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

Solution (Python):

n=int(input())






k=int(input())
ans=1
for i in range(n):
  if ans>k:
    ans+=k
  else:
    ans=2*ans
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())
num = 1
for i in range(N):
    if num > K:
        num += K
    else:
        num = num*2
print(num)

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

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

if __name__ == "__main__":
  resolve()

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

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

MIN = 10**18
for i in range(2**N):
    s = 1
    for j in range(N):
        if ((i >> j) & 1):
            s *= 2
        else:
            s += K
    MIN = min(s,MIN)
print(MIN)

Solution (Python):
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal


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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()

N = ni()
K = ni()


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


print(solve())

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    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__':
    resolve()

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

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

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

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

for i in range(5):
    a = 2**i
    if a >= k:
        b = i
        break

res = 1

res = res*(2**(min(n,b))) + k*max(0,(n-b))
print(res)

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())
ans = float('inf')

for i in range(2**N):
  now = 1
  for j in range(N):
    if i>>j & 1:
      now *= 2
    else:
      now += K
  ans = min(ans, now)

print(ans)

Solution (Python):


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    k = ii()
    num = 1
    for _ in range(n):
        num = min(num * 2, num + k)
    print(num)

if __name__ == "__main__":
    main()

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

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

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())
s = 1

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

Solution (Python):
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

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

if __name__ == '__main__':
    main()

Solution (Python):
import queue

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

que = queue.Queue()
que.put((1, 0))

min = -1
while (True):
    if que.empty():
        break
    test = que.get()
    
    num = test[0]
    count = test[1]
    if count == N:
        if min == -1 or min > test[0]:
            min = test[0]
        continue
    que.put((num * 2, count + 1))
    que.put((num + K, count + 1))
print(min)