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.



Sample input:
4
3


Sample output:
10

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    r,g = IR(2)
    print(2*g-r)

#B
def B():
    n = I()
    k = I()
    a = 1
    for i in range(n):
        if a > k:
            a += k
        else:
            a *= 2
    print(a)
#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,k=eval('int(input()),'*2);r=1
for _ in[0]*n:r+=min(r,k)
print(r)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
anss = []
for i in range(2**N):
    tmp = 1
    for j in range(N):
        if (i >> j) % 2 == 1:
            tmp *= 2
        else:
            tmp += K
    anss.append(tmp)
print(min(anss))

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

dp = [0]*(N+1)
dp[0] = 1

for i in range(1, N+1):
    dp[i] = min(dp[i-1]+K, dp[i-1]*2)
print(dp[-1])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
ans = 1
for i in range(10):
  ans *= 2
  n -= 1
  if ans >= k or n == 0:
    break
print(ans + k*n)

Submission status: Accepted

Solution code:
""" AtCoder """

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
K = int(input())
ans = 1
for _ in range(N):
  if ans < K:
    ans *= 2
  else:
    ans += K
print(ans)

Submission status: Accepted

Solution code:
a=[int(input()) for i in range(2)]
ans=1
for i in range(a[0]):
    ans=min(ans*2,ans+a[1])
print(ans)

Submission status: Accepted

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

ans = 1
num = 0
while num < N:
    if ans < K: ans += ans
    else:       ans += K
    num += 1

print( ans )

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1

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

    else:
        ans += k
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
res = 10**10
for i in range(1 << n):
    total = 1
    for j in range(n):
        if (i >> j) & 1 == 1:
            total *= 2
        else:
            total += k
    if res > total:
        res = total
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
a = []
x = 1
for line in sys.stdin:
    a.append(int(line))
for hoge in range(a[0]):
    x += x if x < a[1] else a[1]
print(x)

Submission status: Accepted

Solution code:
n=int(input());k=int(input());r=1
for _ in[0]*n:r+=min(r,k)
print(r)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(num)

Submission status: Accepted

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

n = 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools

def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("")
    elif (x<y): print("")
    else: print("")

def ip():
    return int(input())

def swap(s,pos):
    s[pos]-=1
    s[pos+1]+=1
    print(s)
    if pos == n-2: return s
    if s[pos+2] == 0: swap(s,pos+1)
    return s


n = ip()                              #入力整数1つ
#left,n= (int(i) for i in input().split())      #入力整数横2つ
#n,x,y = (int(i) for i in input().split())    #入力整数横3つ
#n,m,x,y= (int(i) for i in input().split())  #入力整数横4つ
#a = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)

k = ip()

#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
s =1
for i in range(n):
    s = min(s*2,s+k)
print(s)

Submission status: Accepted

Solution code:
N,K = int(input()),int(input())
A = 1
for i in range(N):
    J1 = A * 2
    J2 = A + K
    if J1 < J2:
        A = J1
    else:
        A = J2
print(A)

Submission status: Accepted

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

ans = 1

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
keizi = 1
N = int(input())
K = int(input())

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

print(keizi)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def foo(N, K):
    x = 1
    for i in range(N):
        x = min([x*2, x+K])
    return x

print(foo(int(input()), int(input())))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
ans = 0
num = 1
for i in range(N):
  if(num*2 < num+K):
    num *= 2
  else:
    num += K
  ans = max(ans, num)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
int_n = int(input())
int_k = int(input())

counter = 1

for i in range(int_n):
    if (counter * 2) <= (counter + int_k):
        counter = counter * 2
    else:
        counter = counter + int_k

print(counter)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(s)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def func(x, k):
    return min([2 * x, x + k])


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

    now = 1
    for _ in range(n):
        now = func(now, k)
    print(now)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# ABC 076
def getInt(): return int(input())
def zeros(n): return [0]*n
def genBit(n): # n個の0/1のリストを生成　[0]から変化
    blist = zeros(n)
    for i in range(2**n):
        for k in range(n):
            blist[k] = i%2
            i //= 2
        yield blist
def db(x): 
    global debug
    if debug: print(x)
debug = False

N = getInt()
K = getInt()
minD = 0
for b in genBit(N):
    d = 1
    for i in range(N):
        if b[i]==0: d*=2
        if b[i]==1: d+=K
    if minD==0: minD = d
    elif d<minD: minD = d
    db(minD)
print(minD)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 1
count = 0
while n > count and ans <= k:
    ans *= 2
    count += 1
    
print((n - count) * k + ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
b=int(input())
p=len(format(b,"b"))
print(2**min(a,p)+b*(max(a-p,0)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
i = 1
j = 1

if N == 1:
    print(2)
else:
    while j < K:
       i = i+1
       j = j*2

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

    print(j)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(current)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, k = [int(input()) for _ in range(2)]
ans = 1
while ans < k and n:
    ans *= 2
    n -= 1
while n:
    ans += k
    n-= 1
print(ans)

Submission status: Accepted

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

print(num)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


abc076_b()

Submission status: Accepted

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

x = 1

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

Submission status: Accepted

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

ans = 1
ncount = 0
for i in range(n):
  ans *= 2
  ncount += 1
  if ans > k:
    break

nrest = n - ncount
for j in range(nrest):
  ans += k
  
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    """Function."""
    n = int(input())
    k = int(input())

    flag = 0
    temp = 1
    for _ in range(n):
        if flag == 0:
            if temp < k:
                temp = temp * 2
            else:
                temp += k
                flag = 1

        elif flag == 1:
            temp += k
    print(temp)


if __name__ == "__main__":
    main()

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
N, K = int(input()), int(input())
val = 1
for _ in range(N):
    if val * 2 >= val + K:
        val += K
    else:
        val *= 2
print(val)

Submission status: Accepted

Solution code:
N=int(input())
K=int(input())
A=0
B=0
kekka=1
Min=1

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

print(Min)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
K = input()
res = 1
for i in range(N):
    res = min(res * 2, res + K)
print res

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
integer = 1

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

    else:
        integer = 2*integer

print(integer)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
k=int(input())
c=1

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

print(c)

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
outcome = 1

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

print(outcome)

Submission status: Accepted

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

point = 1

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


print(point)

Submission status: Accepted

Solution code:
a = int(input())
b = int(input())
i = 1
out = 1

while i <= a:
  if out >= b:
    out += b
  else:
    out *= 2
  i += 1

print(out)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math


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

A = min(N, math.ceil(math.log2(K)))

print(2 ** A + K * (N - A))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

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

print(c)

Submission status: Accepted

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

ans = 1

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

print(ans)

Submission status: Accepted

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

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

print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int( input())
k = int( input())
x=1
for i in range(0,n):
  if x<k:
    x=x*2
  else:
    x=x+k
print(x)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin


def main() -> None:
    n, k = [int(next_str()) for _ in range(2)]
    ans = 1
    for i in range(n):
        ans = min(ans * 2, ans + k)
    print(ans)


def next_str() -> str:
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
a=1
i=0
while (a<=K) and i<=N-1:
    a = a*2
    i = i+1
print(a+K*(N-i))

Submission status: Accepted

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

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

print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,K = [int(input()) for i in range(2)]
p = 1
for i in range(N):
  p = min(2*p,p+K)
print(p)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
k = int(input())
c = 1

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

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

risuto = [1]
for i in range(N):
    if (risuto[-1] + K > risuto[-1] * 2):
        risuto.append(risuto[-1] * 2)
    else:
        risuto.append(risuto[-1] + K)
        
print(max(risuto))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
k = ni()

res = 1

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

index=0
currentN =1
while index < n:
    if currentN+k > currentN*2:
        currentN*=2
    else:
        currentN+=k
    index+=1

print(currentN)

Submission status: Accepted

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

num = 1

while num < K and N > 0:
	num <<= 1
	N -= 1
print(num+K*N)

Submission status: Accepted

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