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

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(input())




sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
K = INT()

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

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

ans = 10 ** 18
for i in itertools.product('AB', repeat = N):
    tmp = 1
    for j in i:
        if j == 'A':
            tmp *= 2
        else:
            tmp += K
    
    ans = min(ans, tmp)

print (ans)

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

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

print (ans)

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

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_list = []
for a in range(N+1):
    tmp = 1
    b = N - a
    for i in range(a):
        tmp  *= 2
    tmp += b * K
    ans_list.append(tmp)   
print(min(ans_list))

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

Solution (Python):
n = int(input())
k = int(input())
tmp = []

for i in range(0,n+1):
  x = 1
  x = x * (2**i)
  x = x + (n-i)*k
  tmp.append(x)
print(min(tmp))

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

min_ans = 10**10
for i in range(2 ** n):
    ans = 1
    for j in range(n):
        if i & 2 ** j:
            ans += k
        else:
            ans *= 2
    min_ans = min(min_ans, ans)
print(min_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):
    if ans < K:
        ans *= 2
    else:
        ans += K
print(ans)

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

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



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

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

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

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

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

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

print(res)

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

for i in range(a):
  c+=min(b,c)
else:
  print(c)

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

num=1

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

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

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

print(ans)

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

Solution (Python):



N, K = int(input()), int(input())
op_a, op_b, total = 0, 0, 1

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

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

for i in range(n+1):
    num=1
    j = n-i
    for x in range(i):
        num *= 2
    num += k*j
    
    if i==0:
        ans = num
    elif num < ans:
        ans = num

print(ans)

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

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

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

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

Solution (Python):


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


if __name__ == "__main__":
    solve()

Solution (Python):
nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

N = n()
K = n()

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

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

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

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


abc()

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

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

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

print(ans)

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

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

print(ans)

Solution (Python):
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys
import string


if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")









N, K = [int(sys.stdin.readline()) for _ in range(2)]
ans = 1
for n in range(N):
    ans = min(ans *2, ans+K)
print(ans)

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


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

print(a)

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

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

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

cnt=1
cur=1

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

Solution (Python):


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

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

print(answer)

Solution (Python):


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

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



if __name__ == '__main__':
    main()

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

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

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


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

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

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

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

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

print(ans)

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

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

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

print(answer)

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

def solve(cnt,n,k):
    if n == 0:
        return print(cnt)
    cnt = min(cnt*2,cnt+k)
    return solve(cnt,n-1,k)

solve(1,n,k)

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

Solution (Python):
import sys
input = sys.stdin.readline

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

Solution (Python):
def smaller(x, y):
	if x < y: return x
	return y

N = int(input())
K = int(input())
dp = [1]
for i in range(0, N):
	dp.append(smaller(dp[-1]*2, dp[-1]+K))
print(dp[N])

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, K = [int(input()) for _ in range(2)]

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

print(a)

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

Solution (Python):

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

Solution (Python):
from sys import stdin
N=int(stdin.readline().rstrip())
K=int(stdin.readline().rstrip())

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

Solution (Python):
from sys import stdin
N=int(stdin.readline().rstrip())
K=int(stdin.readline().rstrip())
num = 1
cnt = 0
while num < K:
    num = num * 2
    cnt += 1
    if cnt >= N:
        break
for _ in range(N-cnt):
    num += K
print(num)

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

  else:
    ans+=K
print(ans)

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

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

old = [1]
for i in range(N):
  new = []
  for i in old:
    new.append(i*2)
    new.append(i+K)
  old = new
print(min(old))

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

c = 1

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

print c

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):
def dp_min(a, b):
    if a > b:
        return b
    return a


N = int(input())
K = int(input())
dp = [1] + [0]*N
for i in range(N):
    dp[i+1] = dp_min(dp[i]*2, dp[i]+K)
print(dp[N])

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

Solution (Python):
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint

import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
def unite(x, y):
    
    x = root(x)
    y = root(y)
    if x == y:
        return
    
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  
        return x
    else:
        node[x] = root(node[x])  
        return node[x]
def dfs(v):
    
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  
            continue
        if visited[v2] == True:  
            continue
        dfs(v2)


n = II()
k = II()
ans = INF
for i in range(2 ** n):
    tmp = [0] * n 
    for j in range(n):
        if (i >> j & 1):
            tmp[j] = 1
    num = 1
    for ope in tmp:
        if ope == 1:
            num *= 2
        else:
            num += k
    ans = min(ans, num)
print(ans)

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

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

while N > 0:
    if number <= K:
        number *= 2
        N -= 1
    else:
        number += K
        N -= 1
print(number)

Solution (Python):
N = int(input())
K = int(input())
Inf = float("inf")
dp = [Inf]*(N+1)
dp[0] = 1
for i in range(N):
    dp[i+1] = min(dp[i]*2,dp[i]+K)

print(dp[N])

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

ans = 2**10 +1
for i in range(1,N+1):
    x = 1
    for j in range(i):
        x *= 2
    for k in range(N-i):
        x += K
    ans = min(x,ans)
print(ans)

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

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

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

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

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

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

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

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

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())
count = 0
ans = 1
while n != count:
    if ans*2 >= ans+k:
        ans += k
    else:
        ans = ans*2
    
    count += 1
print(ans)

Solution (Python):
import math

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

twice_count = min(N, int(math.log2(K)) + 1)
print(2**twice_count + K*(N - twice_count))

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

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

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

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

print(s)

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

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

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

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

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

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

for i in range(a):
  res = min(res*2,res+b)

print(res)

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

a=1

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

print(a)

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

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

Solution (Python):
import sys
n=int(input())
k=int(input())
x=1
cnt=0
while cnt<n:
    while x<k:
        x*=2
        cnt+=1
        if cnt==n:
            print(x)
            sys.exit()
    x+=k
    cnt+=1
print(x)

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

Solution (Python):
n=int(input())
k=int(input())
ans=[]
for i in range(2**n):
    ln=["a"]*n
    tmp=1
    for j in range(n):
        if ((i>>j)&1):
            ln[n-j-1]="b"
    for m in range(n):
        if ln[m]=="a":
            tmp=tmp*2
        elif ln[m]=="b":
            tmp=tmp+k
    ans.append(tmp)
print(min(ans))

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

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

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

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

print(ans)

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())
A = 1
for i in range(N):
    a = A * 2
    b = A + K
    if a>b:
        A = b
    else:
        A = a
print(A)

Solution (Python):
n = int(input())
k = int(input())
a = []
b = 1
for i in range(n):
    a.append(min(b*2,b+k))
    b = min(b*2,b+k)
print(a[-1])

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

a = 1

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

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

n = 1

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

Solution (Python):


def solve(n,k):
  ret = 1
  while n>0:
    if ret <= k:
      ret *= 2
    else:
      ret += k
    n -= 1
  return ret


if __name__ == "__main__":
  n = int(input())
  k = int(input())
  print(solve(n,k))

Solution (Python):

import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def dfs(v, k, n):
    if n == 0:
        return v

    return min(dfs(2 * v, k, n - 1), dfs(v + k, k, n - 1))

def solve(N: int, K: int):
    return dfs(1, K, N)


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))  
    result = solve(N, K)
    if isinstance(result, Iterable):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()

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

Solution (Python):
from functools import reduce
import math

def main():
    
    
    
    

    
    
    
    
    
    

    
    

    
    
    
    
    
    
    
    
    
    INF = float("inf")

    
    MOD = 10**9+7
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

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

Solution (Python):

def read_input():
    n = int(input())
    k = int(input())
    return n, k

def submit():
    n, k = read_input()

    curr = 1
    for i in range(n):
        p1 = curr * 2
        p2 = curr + k

        curr = min(p1, p2)

    print(curr)


if __name__ == '__main__':
    submit()

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

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

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    k = f()[0]

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

solve()

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

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

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

f = [lambda x : x * 2, lambda x : x + K]

o = 1024
for i in range(2**N):
    p = 1
    for j in [(i//(2**x))%2 for x in range(N)]:
        p = (f[j])(p)
    o = min(o,p)

print(o)

Solution (Python):
import sys
from collections import Counter

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

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

print(ans)

Solution (Python):

n, k = list(map(int, [input().rstrip() for _ in range(2)]))
total = 1
for _ in range(n):
    total = min(total * 2, total + k)
print(total)

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

Solution (Python):
def dfs(i,v):
    if i == N:
        return v
    return min(dfs(i+1,2*v),dfs(i+1,v+K))

N = int(input())
K = int(input())
print(dfs(0,1))

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

Solution (Python):

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

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

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, K = eval("int(input())," * 2)
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())
K = int(input())

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

print(ans)

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

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

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

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

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

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

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

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

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

print(now)

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):
a = int(input())
b = int(input())
c = 1

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

print(c)

Solution (Python):

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

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

print(x)

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

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

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

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

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

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

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

while num <= k and n:
    num *= 2
    n -= 1
while n:
    num += k
    n -= 1
print(num)

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

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

Solution (Python):
N = int(input())
K = int(input())
i = 0
ans = 1
while i < N:
    ans = min(ans * 2, ans + K)
    i += 1
print(ans)

Solution (Python):
N, K = map(int, open(0).read().split())
ans = 1
for i in range(N):
    if ans < K:
        ans = ans << 1
    else:
        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())

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

Solution (Python):
n,k=map(int,open(0));r=1;exec('r+=min(r,k);'*n);print(r)

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

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

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

print(tmp)

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

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

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

print(val)