Problem:
 Score : 400 points    Problem Statement Snuke has one biscuit and zero Japanese yen (the currency) in his pocket.
He will perform the following operations exactly K times in total, in the order he likes:   Hit his pocket, which magically increases the number of biscuits by one.  Exchange A biscuits to 1 yen.  Exchange 1 yen to B biscuits.   Find the maximum possible number of biscuits in Snuke's pocket after K operations.      Constraints  1 \leq K,A,B \leq 10^9  K,A and B are integers.         Input Input is given from Standard Input in the following format:  K  A  B       Output Print the maximum possible number of biscuits in Snuke's pocket after K operations.        Sample Input 1 4 2 6      Sample Output 1 7  The number of biscuits in Snuke's pocket after K operations is maximized as follows:   Hit his pocket. Now he has 2 biscuits and 0 yen.  Exchange 2 biscuits to 1 yen. his pocket. Now he has 0 biscuits and 1 yen.  Hit his pocket. Now he has 1 biscuits and 1 yen.  Exchange 1 yen to 6 biscuits. his pocket. Now he has 7 biscuits and 0 yen.        Sample Input 2 7 3 4      Sample Output 2 8       Sample Input 3 314159265 35897932 384626433      Sample Output 3 48518828981938099

Solution (Python):
k,a,b=map(int,input().split())
kosupa=b-a
j=0
bisket=1
if kosupa>2 and k>a:
    bisket=a
    k=k-a+1
    j=int(k/2)
    k-=j*2
    bisket+=j*(b-a)
    if k >= 1:
        k-=1
        bisket+=1
else:
    bisket+=k
    k=0
print(int(bisket))

Solution (Python):
K, A, B = list(map(int, input().split()))

if (A + 2 >= B):
    print(K + 1)
elif (A >= K):
    print(K + 1)
else:
    rest = K - (A - 1)
    if (rest%2 == 0):
        print((B - A) * int(rest / 2) + A)
    else:
        print((B - A) * int(rest / 2) + A + 1)

Solution (Python):
K, A, B = map(int, input().split())



bis = 1
ad = B - A
starts = 2
if (B - A) > 1:
    bis = A
    K -= (A - 1)
    if K <= 1:
        print(bis + 1)
        exit(0)
    mades = int(K / 2)
    if (K /2- mades) != 0:
        bis += 1
    bis += (mades * ad)
    print(bis)
    exit(0)
else:
    print(K + 1)
    exit(0)

Solution (Python):
from math import ceil
K, A, B = map(int, input().split())
b = 1

if B - A > 2:
    b += min(A - 1, K)
    K -= min(A - 1, K)
    if K == 0:
        print(b)
        exit()
    n = K // 2
    b += n * (B - A)
    b += K % 2
    print(b)
else:
    b += K
    print(b)

Solution (Python):
K,A,B = map(int,input().split())

K += 1
ans = 0

if K < A :
    ans += K
else :
    if (A+2) >= B :
        ans = K
    else :
        ans = A + ((K-A)//2)*(B-A) + (K-A)%2
print(ans)

Solution (Python):
K, A, B = map(int, input().split())
cookie = 1
coin = 0

delta = B - A

if delta <= 2 or A >= K:
    print(K+cookie)
    exit()


fst_hit = A - 1
cookie += fst_hit


exchange_count = int((K - A+1)/2)
cookie += (delta * exchange_count)


cookie += (K-fst_hit) % 2

print(cookie)

Solution (Python):
K,A,B = (int(x) for x in input().split())

if A >= B-1:
    print(1+K)
else:
    if K <= A:
        print(1+K)
    else:
        if (K-A+1)%2==0:
            print(int(A+(B-A)*int((K-A+1)/2)))
        else:
            print(int(1+A+(B-A)*int((K-A)/2)))

Solution (Python):
K,A,B = [int(_) for _ in input().split()]
N = 1
Y = 0

if A+2 >= B:
    print(N+K)
else:
    n = K+1-(A+2)
    m = n//2
    if n%2 == 0:
        N = B + (B-A) * m
    else:
        N = B + (B-A) * m + 1
    print(N)

Solution (Python):
k,a,b=map(int,input().split())
if a+2>=b or a>=k:
  print(1+k)
  exit()
k-=(a+1)
if k==1:
  print(b+1)
elif k%2==0:
  print(int(b+(b-a)*(k//2)))
else:
  print(int(b+(b-a)*((k-1)//2)+1))

Solution (Python):
bis=0
yen=0

k,a,b=map(int,input().split())

k_num =k 
n=b-a 

k_num-=(a-1) 

func_num=k_num/2 
func_num=int(func_num)

add_bis=func_num*n 

if(k_num%2==1): 
    bis +=1



if(k<3 and a>1 or n<3):
    print(k+1)
else:
    print(bis+add_bis + a)

Solution (Python):

K,A,B=map(int,input().split())


bs = 1
yen = 0

if B-A > 2 and K >= (A-1):
    K = K -(A - 1)
    numC = K//2
    yen = A+(B-A) * numC + K%2
    print(yen)
else:
    print(1+K)

Solution (Python):
K,A,B = list(map(int, input().strip().split(' ')))

if B-A >= 3 and K >= A+2-1:
  bis = B
  K = K-(A+2-1)
  rem = K%2
  bis = bis + (B-A)*(K//2) + rem

else:
  bis = 1+K

print(bis)

Solution (Python):
import math
K,A,B = list(map(int, input().strip().split(' ')))
biscuit = 1
if B-A <= 2: 
  print(1+K)
  exit()
remain_act = K
while remain_act > 0:
  if biscuit < A: 
    if remain_act >= A-biscuit+2: 
      biscuit += A-1
      remain_act -= A-1
    else: 
      biscuit += remain_act
      remain_act = 0
  elif remain_act > 1: 
    t = math.floor(remain_act/2)
    biscuit += (B-A)*t
    remain_act -= 2*t
  elif remain_act == 1:
    biscuit += 1
    break
print(biscuit)

Solution (Python):
def main():
    k, a, b = map(int, input().split())
    print(solve(k, a, b))

def solve(k, a, b):
    if b - a <= 2:
        return k + 1
    
    if (k - a + 1) % 2 == 0:
        n = (k - a + 1) // 2
        return a + (b - a) * n
    else:
        n = (k - a + 1) // 2
        return a + (b - a) * n + 1

main()

Solution (Python):
k, a, b = map(int, input().split())
first_k = k
bis = 1
if b - a >= 2:
    
    
    k -= a - 1
    bis += a - 1
    change_count = k//2
    bis += change_count * (b - a)
    if bis >= 0:
        print(bis + (k % 2))
    else:
        print(first_k+1)

else:
    
    print(k+1)

Solution (Python):
import math

data = input().split()  

k = int(data[0])
a = int(data[1])
b = int(data[2])


bi=1


if(a+2>=b):
    bi=k+1
elif((a+2)>(k+1)):
    bi=k+1
else:
    bi+=(b-a)+(a-1)
    k-=(a+1)
    bn = math.floor(k/2)
    bb = k%2
    bi+=(bn*(b-a) + bb)

print(bi)

Solution (Python):
K,A,B = map(int, input().split())

if B-A < 2 or K < A+1:
    ans = 1+K
else:
    K -= A+1
    if K%2 == 0:
        ans = B + (B-A) * (K//2)
    else:
        ans = B + ((B-A) * (K//2)) + 1

print(ans)

Solution (Python):
tmp = input().split()
K = int(tmp[0])
A = int(tmp[1])
B = int(tmp[2])
diff = B-A

if B-A <=2:
	print(K+1)
else:
	tmp = (A-1)
	tmp2 = A + diff*int((K-tmp)/2) + (K-tmp)%2
	print(int(tmp2))

Solution (Python):
K,A,B = map(int, input().split())
bis=1
nokori_kaisuu=K
if A+3<B:
    tataki_onechange_max=K-2
    if tataki_onechange_max+1>=A:
        bis+=((A-1)+(B-A))
        nokori_kaisuu-=((A-1)+2)
        more_change_kaisuu=nokori_kaisuu//2
        bis+=(B-A)*more_change_kaisuu
        nokori_kaisuu-=2*more_change_kaisuu
        if nokori_kaisuu==1:
            bis+=1
    else:
        bis+=K
else:
    bis+=K
print(bis)

Solution (Python):
K, A, B = (int(i) for i in raw_input().split(' '))

action = K
cookie = 1

if A + 3 > B:
    cookie += K
    print(cookie)
else:
    init_break_n = min(action, A - cookie)
    action += -(init_break_n)
    cookie += init_break_n
    if action > 0:
        trade_n = int(action/2)
        cookie += (B-A)*trade_n
        if action % 2 == 1:
            cookie += 1
    print(cookie)

Solution (Python):
K,A,B=input().split()
K=int(K)
A=int(A)
B=int(B)

def solve(A,B,K):
    if A>=B-1 or A-1>=K:
        return K+1
    K-=(A-1)
    if K%2==0:
        return int(A+(B-A)*int(K/2))
    else:
        return A+(B-A)*int((K-1)/2)+1

print(solve(A,B,K))

Solution (Python):
K, A, B = map(int,input().split())
if K < A+1 or B-A <= 2 :
    print(K+1)
else:
    t = (K - A - 1) //  2
    if (K - A - 1) % 2 != 0:
        ans = B + t * (B - A) + 1
    else:
        ans = B + t * (B - A)
    print(ans)

Solution (Python):
K,A,B = map(int,input().split())

ans = 0
if A+2 >= B or K+2 < A:
    ans = K + 1
else:
    tmp = K - A

    if tmp%2 == 1:
        I = tmp+1
        I //= 2
        ans = I *B - (I-1)*A
    else:
        I = tmp
        I //= 2
        ans = 1 + I*B - (I-1)*A

print(ans)

Solution (Python):

k, a, b = map(int, input().split())

ans = 1 + k
if b <= a + 2:
    print(ans)
else:
    if (k - a + 1) % 2 == 0:
        i = a - 1
    else:
        i = a
    ans = 1 + i + ((b - a) * (k - i) // 2)
    print(ans)

Solution (Python):
K,A,B = map(int,input().split())
ans = 1

if (B-A) > 2:
    change = True
else:
    change = False

can = False
while(True):
    if change:
        if can:
            multi = K//2
            K -= 2*multi
            ans += (B-A)*multi
            ans += K
            break
        else:
            if ans >= A:
                if (K-2) >= 0:
                    ans -= A
                    ans += B
                    K -= 2
                    can = True
                else:
                    ans += K
                    K -= K
                    break
            else:
                if ans + (K-2) >= A:
                    K -= (A-ans)
                    ans = B
                    K -= 2
                else:
                    ans += K
                    K -= K
                    break                
    else:
        ans += K
        K -= K
        break

print(ans)

Solution (Python):
import math
K, A, B = map(int, input().split())
ans = K+1
if B > 2 + A:
  N = K - A
  if N == 1:
    ans = B
  elif N%2==1:
    ans=B+(B-A)*math.floor((K-A)/2)
  elif N%2==0:
    ans=B+(B-A)*math.floor((K-A)/2-1)+1

print(ans)

Solution (Python):
K,A,B=map(int, raw_input().split())


if B<=A+2:
	print 1+K
else:
	ans=0

	K-=(A-1)
	ans+=A
	
	t=K/2
	K-=t*2
	ans+=(B-A)*t

	ans+=K

	print ans

Solution (Python):
K, A, B = map(int, input().split())

unused_turn = K
biscuit = 1


if B - A <= 1 or K < A:
    print(1 + K)
    exit()


unused_turn -= A - 1
biscuit += A - 1



turn = unused_turn // 2
biscuit = biscuit - turn * A + turn * B
unused_turn -= turn * 2


biscuit += unused_turn

print(biscuit)

Solution (Python):
k,a,b=map(int,input().strip().split())
if b-a<=2:
    print(1+k)
else:
    d=b-a
    step=k-a+1
    if step%2==0:
        n=int(step/2)
        print(a+n*d)
    else:
        n=int(step/2)
        print(a+n*d+1)

Solution (Python):
k,a,b = map(int,input().split())
counter = k
x = 1
s = 0

if a >= b or (a < b and b - a <= 2) or counter < a - 1:
    x = 1+k
elif a < b and b - a > 2:
    counter -= a-1
    x += a-1
    if counter > 1 and counter % 2 == 0:
        z = int(counter/2)
        x += int((b-a)*z)
    elif counter > 1 and counter % 2 == 1:
        z = int(counter/2)
        x += int((b-a)*z + 1)
    elif counter == 1:
        x += 1


print(x)

Solution (Python):
k, a, b = map(int, input().split())
if a >= b-1 or k < a:
  print(k+1)
  exit(0)

k -= a+1
answer = b
answer += (k // 2) * (b - a)
answer += k % 2

print(answer)

Solution (Python):
In = list(map(int, input().split()))
K = In[0]
A = In[1]
B = In[2]

if A >= B:
    print(1 + K)
elif A + 1 == B:
    print(1 + K)
elif A + 2 == B:
    print(1 + K)
else:
    n = A - 1 
    if (K - n) % 2 == 0:
        print(A + (B - A) * (K - n) // 2)
    else:
        num = 1 + A + (B - A) * (K - n - 1) // 2
        print(num)

Solution (Python):
k,a,b = map(int, input().split())

ans1 = k+1
cnt = (k-(a-1)) // 2
mod = (k-(a-1)) % 2
ans2 = cnt * (b - a) + a + mod

print(max(ans1,ans2))

Solution (Python):
K, A, B = map(int, input().split())

if B - A <= 2 or K + 1 - A < 2:
    print(K+1)
else:
    sum = B
    K = K + 1 - A - 2
    if K % 2 == 1:
        K -= 1
        sum +=1
    sum += B * (K // 2) - A * (K // 2)

    print(sum)

Solution (Python):


K, A, B = list(map(int, input().split()))
answer = 0

if B - A <= 2:
    answer = 1 + K


else:
    K = K - A + 1
    answer = A
    answer += int(K/2) * (B-A)
    if K % 2 ==1:
        answer += 1

print(answer)

Solution (Python):
K,A,B = map(int,input().split())
bisc = 1
money = 0

if B-A < 3:
  print(bisc + K)
else:
  bisc += A-1
  K -= A-1
  if K >= 2:
    change_n = int(K/2)
    bisc += change_n*(B-A)
    K -= change_n*2
  bisc += K
  print(bisc)

Solution (Python):
K,A,B = map(int,input().split())
bisc = 1
money = 0

if B-A < 3:
  print(bisc + K)
else:
  bisc += A-1
  K -= A-1
  if K >= 2:
    change_n = int(K/2)
    bisc += change_n*(B-A)
    K -= change_n*2
  bisc += K
  print(bisc)

Solution (Python):
K, A, B = map(int, input().split())

if B - A <= 2 or K - 1 < A:
    print(K + 1)
else:
    if (K - A + 1) % 2 == 0:
        print(A + (B - A) * ((K - A + 1) // 2))
    else:
        print(1 + A + (B - A) * ((K - A + 1) // 2))

Solution (Python):
K, A, B = [int(_) for _ in input().split()]

if A + 2 >= B:
    print(K + 1)
else:
    temp = (K - A + 1)
    n = temp // 2

    result = n * B - (n - 1) * A + temp % 2

    print(result)

Solution (Python):
K, A, B = list(map(int, input().split()))

if A >= B -1: 
    re = K + 1
else:
    ite = (K - (A - 1) ) // 2
    re = B * ite - A *(ite - 1) 
    if (K - (A - 1)) % 2 == 1:
        re += 1
print(re)

Solution (Python):
k, a, b = map(int, input().split())
breakonly = k + 1
if a <= b-2:
    k = k + 1 - a
    ans = k // 2 * (b - a)
    ans += max(0, k - (k // 2 * 2)) 
    print(ans + a)
else:
    print(breakonly)

Solution (Python):
k, a, b = map(int, input().split())

have = 1
if b - a > 2 and k >= a + 1:
    k -= a + 1
    have = b
    have += (b - a) * (k // 2)
    k %= 2
    have += k
    print(have)
else:
    print(have + k)

Solution (Python):
K,A,B = map(int, raw_input().split())

count = 1

if B-A<=2 or A>K+1:
	count += K
	K = 0

else:
	K=K-A+1
	count=A

	count += K/2 * (B-A)
	count += K%2


print count

Solution (Python):
import math

K, A, B = map(int, input().split(' '))


if B - A <= 2 or K <= A:
    biscuit = K + 1
    
else:
    if (K - A) % 2 != 0:
        b = math.ceil((K - A) / 2)
        a = math.floor((K - A) / 2)
        biscuit = b * B - a * A
        
    else:
        b = math.ceil((K - A - 1) / 2)
        a = math.floor((K - A - 1) / 2)
        biscuit = b * B - a * A + 1
    
print(biscuit)

Solution (Python):
K, A, B = map(int, input().split())

ans = min(A, K)
cnt = min(A - 1, K - 1)
res = K - cnt
if B - A >= 2:
    ans += (B - A) * (res // 2)
    ans += res % 2
else:
    ans += res

print(ans)

Solution (Python):
k,a,b=map(int,input().split())

if (b-a)/2<=1:
    print(k+1)
else:
    s=k-a-1
    if s%2==0:
        print(int((s//2+1)*b-(s*a)//2))
    else:
        s1=s-1
        print(int((s1//2+1)*b-(s1*a)//2+1))

Solution (Python):
def solve(k, a, b):
    if b <= a + 2:
        return 1 + k
    
    c = 0
    k += 1
    
    if k < a + 2:
        return k
    c = 0
    k -= a + 1
    num_iter, rest = divmod(k, 2)
    if rest == 0:
        
        c += (num_iter - 1) * (b - a)
        c += b + 1
    else:
        c += num_iter * (b - a) + b
    return c


def main():
    k, a, b = (int(z) for z in input().split())
    res = solve(k, a, b)
    print(res)


if __name__ == "__main__":
    main()

Solution (Python):
k, a, b = [int(x) for x in input().split()]

if b - a > 1 and a < k:
    bk = b + ((k - (a + 1)) // 2) * (b - a) + (k - (a + 1)) % 2
else:
    bk = k + 1
    
print(bk)

Solution (Python):
k, a, b = map(int, input().split())

turns = k - (a - 1) - 2
bis = b + (turns // 2) * (b - a) + (turns % 2)

print(max(k + 1, bis))

Solution (Python):
def c_biscuit(K, A, B):
    if A >= B:
        return K + 1
    if B == A + 1:
        return K + 1
    if K <= A - 1:
        return K + 1

    count = A - 1
    now_biscuit = A

    remain_count = (K - count) // 2
    now_biscuit = now_biscuit + remain_count * (B - A)

    if ((K - count) % 2) == 1:
        now_biscuit += 1

    return now_biscuit

K, A, B = [int(i) for i in input().split()]
print(c_biscuit(K, A, B))

Solution (Python):
K,A,B = map(int,input().split())

c = 1
multi = 0
add = 0

if B - A <= 2:
    print(K + c)
    exit()

if B - A > 2:
    if K <= A:
        print(K + c)
        exit()

    K -= A + 1
    c = B
    multi = int((K - (K % 2)) / 2)
    add = (B - A) * multi
    c += add

    if K % 2 == 1:
        c += 1
    print(c)

Solution (Python):
K, A, B = map(int, input().split())
e = B - A

if e <= 2 or A >= K:
    ans = K + 1
else:
    ans = B
    count = A + 1
    while count < K:
        e_count = min(ans // A, (K - count) // 2)
        if e_count > 0:
            ans += e_count * e
            count += e_count * 2
        else:
            if A > ans:
                count += min(A - ans, K - count)
                ans += min(A - ans, K - count)
            else:
                tataku = K - count
                count += tataku
                ans += tataku
print(ans)

Solution (Python):
inp = input().split()

K = int(inp[0])
A = int(inp[1])
B = int(inp[2])

count = 1

remain = K

if (B - A <= 2):
    count += remain
else:
    if (A - 1 >= remain):
        remain = 0
        count += remain
    else:
        while(True):
            remain -= A-1
            count += A-1
            if (remain == 0):
                break
            elif (remain%2== 1):
                count += remain//2*(B-A)
                count += 1
                break
            else:
                count += remain//2*(B-A)
                break


print(count)

Solution (Python):
k,a,b=map(int,input().split())
if b<=a+2 or k<a+1:
    print(k+1)
    exit()
time=(k-a+1)//2
ans = (b-a)*(time-1)+b+(k-a+1)%2
print(ans) if ans >= k+1 else print(k+1)

Solution (Python):
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**8) 
 
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())

    
k,a,b = li()
k += 1

if k <= a:
    print(k)

elif b <= a+2:
    print(k)

else:
    k -= a
    n = k//2
    print(b + (n-1)*(b-a) + bool(k%2))

Solution (Python):
inp  = [int(i) for i in input().split()]
k = inp[0]
a = inp[1]
b = inp[2]
k_ = (k - a + 1)//2
if b - a < 2:
    print(1 + k)
else:
    if (k - a + 1) % 2 == 0:
        print(a + (b - a) * k_)
    else:
        print(a + (b - a) * k_ + 1)

Solution (Python):
(k, a, b) = map(int, input().split())
invest_duration = k - a + 1
invest_gain = b - a
invest_gain = int(invest_duration / 2) * invest_gain + a + (1 if 1 == (invest_duration % 2) else 0)
print(invest_gain if invest_gain > (k + 1) else (k + 1))

Solution (Python):
k,a,b=map(int,input().split())
count=0
if b<=a+2:
    count=k+1
else:
    if k<=a:
        count=k+1
    else:
        x=(k-(a+1))//2
        y=k-2*x-(a+1)
        count=(b-a)*x+b+y

print(count)

Solution (Python):
import math
import copy
import bisect








def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:

            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l

n=nCast(input().split())

def func():

    if n[2]-n[1]<2:
        return 1+n[0]
    if n[1]-1>=n[0]:
        return 1+n[0]

    result=n[1]
    ret=n[0]+1-n[1]
 
    if ret%2==0:

        
        return result+int(ret/2)*(n[2]-n[1])
    return 1+result+int((ret-1)/2)*(n[2]-n[1])

print(int(func()))

Solution (Python):
inp  = [int(i) for i in input().split()]
k = inp[0]
a = inp[1]
b = inp[2]
k_ = (k - a + 1)//2
if b - a < 2:
    print(1 + k)
else:
    if (k - a + 1) % 2 == 0:
        print(a + (b - a) * k_)
    else:
        print(a + (b - a) * k_ + 1)

Solution (Python):
inp  = [int(i) for i in input().split()]
k = inp[0]
a = inp[1]
b = inp[2]
k_ = (k - a + 1)//2
if b - a < 2:
    print(1 + k)
else:
    if (k - a + 1) % 2 == 0:
        print(a + (b - a) * k_)
    else:
        print(a + (b - a) * k_ + 1)

Solution (Python):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
[k,a,b]=i2()

s=a-1
if s>=k:
   s=k+1
else:
   if a>=b:
      s=k+1
   else:
      if k>=2:
         if b-a>1:
          s=(b-a)*((k-(a-1))//2)+a+(k-(a-1))%2
         else:
          s=k+1
      else:
          s=2
print(s)

Solution (Python):


def solve():
    K, A, B = map(int, input().split())
    res = 1
    if B <= A:
        res += K
    elif K <= A:
        res += K
    elif B-A<=2:
        res += K
    else:
        K -= (A-1)
        res += A-1
        res += (K//2)*(B-A)
        res += K%2

    return str(res)
if __name__ == '__main__':
    print(solve())

Solution (Python):
k,a,b = map(int,input().split())

if b-a <= 2:
    print(1+k)
else:
    if k < a+1:
        print(1+k)
    else:
        p = (k-a)//2
        if (k-a-1)%2 == 0:
            print((1+p)*b-p*a)
        else:
            p -= 1
            print((1+p)*b-p*a+1)

Solution (Python):
k, a, b = map(int, input().split())
if a >= b - 2 or a > k:
  print(int(k+1))
elif (k-a+1)%2 == 0:
  print(int((b-a)*(k-a+1)//2 + a))
else:
  print(int((b-a)*(k-a)//2 + 1 + a))

Solution (Python):
K,A,B = map(int,input().split())

ans = 1
cnt = 0

if A + 1 < B and K >= A+1:
    cnt += A + 1
    ans = B
else:
    print(ans + K)
    exit()

if ans >= B:
    k = int((K-cnt) / 2)
    ans += k * (B - A)
    c = int((K-cnt) % 2)
    print(ans+c)
else:
    print(ans + K)

Solution (Python):
k,a,b = list(map(int,input().split()))
if (((b-a)/2) <= 1) or (k <= a):
  print(k+1)
else:
  t = k-a+1
  print((t//2)*(b-a)+(t%2)+a)

Solution (Python):
def main():
	k,a,b = map(int, input().split())
	ans = a
	if a + 1 < b:
		if k < a + 1:
			print(k+1)
			return
		k = k-a+1
		ans += (b-a)*int(k/2)
		print(ans + k%2)
		return
	else:
		print(k+1)

main()

Solution (Python):
import sys


a = list(map(int, input().split()))
K, A, B = a[0], a[1], a[2]

bis = 1
money = 0
sub_K = A + 2 

ad = B - A
if ad <= 2 or K < sub_K - 1:
  print(1+K)
  sys.exit()

else:
  bis = B
  K -= sub_K - 1

exchange = 2 

mult = K // exchange
bis += ad * mult

remain = K % exchange
bis += remain

print(bis)

Solution (Python):
K, A, B = map(int, input().split())

if B-A<=2:
  print(K+1)
else:
  if (K-(A-1))%2!=0:
    print(A+(K-(A-1))//2*(B-A)+1)
  else:
    print(A+(K-(A-1))//2*(B-A))

Solution (Python):
k, a, b = map(int, input().split())
if a+2 >= b:
    ans = k+1
else:
    if k <= a:
        ans = k+1
    else:
        n = k-(a-1)
        if n%2 == 0:
            ans = b + (b-a)*((n-2)//2)
        else:
            ans = b + (b-a)*((n-2)//2)+1
print(ans)

Solution (Python):
import sys

def parse(inp):
    K,A,B=map(int,next(inp).split())
    return K,A,B
  
def main(inp):
    K,A,B=parse(inp)
    
    if(B-A <= 2):
        return K+1
    
    else:

        K=K-A+1
        bis=A+int(K/2)*(B-A)

        
        if(K%2==0):
            return bis
        else: return bis+1
        
print(main(sys.stdin))

Solution (Python):
a=input().split()
b=int(a[0])
c=int(a[1])
d=int(a[2])
x=0
y=0
if d-c<=2:
    x+=b+1
else:
    if b<=min(c,d) :
        x+=b+1
    else:
        x+=c+abs(d-c)*((b-min(c,d)+1)//2)+(b-(min(c,d)-1))%2
print(x)

Solution (Python):
k,a,b=list(map(int,input().split()))
if b-1>a:
    c=a-1
    k-=c
    k-=2
    
    if k%2==0:
        g=(b-a)*(k//2)
        print(g+b)
        
    else:
        g=(b-a)*((k)//2)
        print(b+g+1)
    
    
else:
    print(1+k)

Solution (Python):
k,a,b=map(int,input().split())
n=1
if b-a<=2:
    n += k
    print(n)

elif k<a-1:
    n += k
    print(n)

else: 
    
    n = a
    k -= a-1  
    m = k // 2
    n += (b-a)*m
    if k - 2*m ==1:
        n+=1
    print(n)

Solution (Python):
K, A, B = map(int,input().split())


if A >= B - 2:
    print(K + 1)
else:
    
    n = int((K - (A - 1)) / 2)
    print(n*(B-A-2) + K + 1)

Solution (Python):

K, A, B = map(int, input().split())

if A + 2 >= B:
    print(K + 1)
    exit()

n = A - 1
print(1 + n + (K - n) // 2 * (B - A) + (K - n) % 2)

Solution (Python):
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [K, A, B] = [long(input_raw[0]), long(input_raw[1]), long(input_raw[2])]

    K_ = K - (A - 1)
    print max((B - A) * (K_/2) + A + K_% 2, K + 1)


if __name__ == '__main__':
    main()

Solution (Python):
k,a,b = map(int, input().split())

if b - a < 2:
    print(1+k)
else:
    c = a - 1 + 2
    d = k - c
    if d % 2 == 0:
        print((d//2)*(b-a)+b)
    else:
        print((d//2)*(b-a)+b+1)

Solution (Python):
K, A, B = map(int, input().split(" "))

if B - A <= 1:
    print(K + 1)
else:
    bisket_sum = A
    k_remained = K - A + 1
    bisket_sum += (k_remained // 2) * (B - A)
    bisket_sum += k_remained % 2
    print(bisket_sum)

Solution (Python):
K, A, B = map(int,input().split())

if K <= A or A + 2 >= B:
    print(K + 1)
    exit()

cnt = (K - (A - 1)) // 2
ans = A
ans += (B - A) * cnt
ans += (K - (A - 1)) % 2

print(ans)

Solution (Python):
k, a, b = list(map(int, input().split()))

if a > k-2 +1:
    ans = k +1
elif b-a <= 2:
    ans = k + 1
else:
    if (k-a+1)%2 ==0:
        k2 = (k-a+1)//2
        ans = k2*(b-a) + a
    else:
        k2 = (k-a+1)//2
        ans = k2*(b-a) +a +1
print(ans)

Solution (Python):
K, A, B = map(int, input().split())
count = 0
if(A >= B-2):
    
    count = K+1
else:
    K = K - (A - 1)

    if(K%2==0):
        count += ((K//2)-1)*(B-A) + B
    else:
        count+=(K//2-1)*(B-A) + B
        count+=1
        

print(count)

Solution (Python):
K,A,B = map(int,input().split())
K += 1
if K >= A + 1 and A + 2 < B:
  ans = int((K - A) / 2) * (B - A) + A + (1 if (K - A) % 2 == 1 else 0)
  print(ans)
else:
  ans = K
  print(ans)

Solution (Python):
K, A, B = map(int, input().split())

remain = K - A + 1
if -2 - A + B <= 0 or remain < 2:
    print(1 + K)
else:    
    print(A + (B - A) * (remain // 2) + remain % 2)

Solution (Python):
k,a,b = ([int(i) for i in input().split()])
ans = 1
if 2 >= (b-a):
    ans = ans + k
else:
    n = k - (a-1)
    ans = ans + (a-1)
    if n %2 == 0:
        ans = ans + n//2 * (b-a)
    else:
        ans = ans + n//2 * (b-a) + 1
print(ans)

Solution (Python):
K, A, B = map(int,input().split())
if A+1 >= B:
    print(K+1)
elif A >= K:
    print(K+1)
else:
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    K -= A-1
    biscuit = A
    if K % 2 == 0:
        excnt = int(K/2)
        biscuit += excnt * (B-A)
    else:
        excnt = int(K/2)
        biscuit += excnt * (B-A)+1
    print(biscuit)

Solution (Python):
K,A,B = map(int,input().split())
if A+2 >= B:
	print(1+K)
elif K <= A:
	print(1+K)
else:
	new_K = K-A
	if new_K % 2 == 1:
		temp_K = int((new_K+1)/2)
		print((temp_K*B - (temp_K-1)*A))
	else:
		temp_K = int(new_K/2)
		print((int(temp_K*B - (temp_K-1)*A + 1)))

Solution (Python):






from decimal import Decimal
import decimal





import sys
sys.setrecursionlimit(10000)

def read_int(read=None):
	if read == None:
		read = sys.stdin.readline().strip()
	return int(read)

def read_int_n(read=None):
	if read == None:
		read = sys.stdin.readline().strip()
	return [int(x) for x in read.split()]

def read_float(read=None):
	if read == None:
		read = sys.stdin.readline().strip()
	return float(read)

def read_float_n(read=None):
	if read == None:
		read = sys.stdin.readline().strip()
	return [float(x) for x in read.split()]

def read_str(read=None):
	if read == None:
		read = sys.stdin.readline().strip()
	return str(read)

def read_str_n(read=None):
	if read == None:
		read = sys.stdin.readline().strip()
	return [str(x) for x in read.split()]	
	
def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time
	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(K, A, B):
	if B - A <= 2:
		ans = K + 1
	else:
		if (K - A + 1) % 2 ==0:
			ans = (B-A)*(Decimal(str(K-A+1))/Decimal('2'))+A
		else:
			ans = (B-A)*(Decimal(str(K-A))/Decimal('2'))+A+1
	return ans

def main():
	t = '''4 2 6'''.splitlines()
	K, A, B = read_int_n()
	print(slv(K, A, B))

if __name__ == '__main__':
	main()

Solution (Python):


def f(k,a,b):
    if b-a<=0:
        return k+1
    elif k+1<a:
        return k+1
    else:
        res1 = k+1
        res2 = b
        k -= 1+a
        
        if k>0:
            res2 += (b-a)*(k//2)
            res2 += k%2
        elif k<0:
            res2 = -1
        return max(res1, res2)

def f2(k,a,b):
    k_ = k
    res = 1
    while k>0 and res<a:
        res += 1
        k -= 1
    res += (b-a)*(k//2)
    res += k%2
    return max(res, k_+1)

if __name__ == '__main__':
    k,a,b = map(int, input().split())
    print(f(k,a,b))

Solution (Python):
K, A, B = map(int,input().split())
if B-A <= 2:
    print(K+1)
    exit(0)
elif A-1 >= K:
    print(K+1)
else:
    t = (K-A+1)//2
    print(A + (B-A)*t + K-A+1-2*t)

Solution (Python):
k, a, b = (int(i) for i in input().split())
ans = 0
if a+1>=b or k-a+1<2:
    ans = 1+k
else:
    left = (k-a+1)//2
    ans = left*(b-a) + a
    if (k-a+1)%2==1:
        ans += 1
print(ans)

Solution (Python):
k,a,b=map(int,input().split())

bsc=1
if b-a<=2:
    bsc+=k
elif a-1>=k:
    bsc+=k

else:
    bsc=a
    i=a-1
    bsc+=(k-i)//2*(b-a)
    bsc+=(k-i)%2

print(bsc)

Solution (Python):
K, A, B = [int(n) for n in input().split()]

answer = 1

if A >= B - 2:
    answer += K
else:
    answer += A - 1
    answer += (B - A) * ((K - A + 1) // 2) + (K - A + 1) % 2

print(answer)

Solution (Python):
def main():
    K, A, B = map(int, input().split())
    ans = 1
    if A > 1:
        K -= A - 1
        ans += A - 1
    if K % 2 != 0:
        ans += 1
        K -= 1
    if B - A > 1:
        print((B - A) * (K // 2) + ans)
    else:
        print(ans + K)


main()

Solution (Python):
k,a,b=list(map(int, input().split()))

ans = 0
if a >= b:
    ans = 1+k
elif a+2 <= b:
    k=k-(a-1) 
    if k%2==0:
        ans = a + (k//2)*(b-a)
    else:
        ans = a + (k//2)*(b-a) + 1
else:

    ans = 1+k


print(ans)

Solution (Python):
K, A, B = map( int, input().split())
ans = 0
if A+1 <= K:
    t = (K+1)//(A+2)
    ans = t*B + (K - ((A+2)*t-1))

twoans = A
now = A-1
if A*2 < B:
    while now < K:
        if now + twoans//A*2 <= K:
            now += twoans//A*2
            twoans = twoans - (twoans//A*A) + (twoans//A*B)
        else:
            break
if (K - now)%2 == 0:
    twoans = twoans + (K-now)//2*(B-A)
else:
    twoans = twoans + (K-now)//2*(B-A)+1
print( max(twoans,  ans, K+1))

Solution (Python):
def solve():
  K, A, B = map(int, input().split())
  if B - A <= 2: return K + 1
  if K - 1 < A: return K + 1

  K -= A - 1
  mod = K % 2
  N = K // 2
  return A + (B - A) * N + mod

print(solve())

Solution (Python):
K, A, B = map(int, input().split())

def f():
    
    a = A - 1
    
    b = K - a
    
    d, m = divmod(b, 2)
    return A + (B - A) * d + m

def g():
    return 1 + K

if (A + 2) < B:
    print(f())
else:
    print(g())

Solution (Python):
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

K,A,B = Is()
if B-A <= 2:
    print(K+1)
    exit()
else:
    ans = A-1
    if (K-ans)%2 == 0:
        ans += (K-ans)//2*(B-A)
    else:
        ans += (K-ans-1)//2*(B-A) + 1
    print(ans+1)

Solution (Python):
k, a, b = list(map(int, input().split()))

if a + 2 <= b and k + 3 > a:
    k -= a - 1
    n = k // 2
    x = (b - a) * n + a
    y = k % 2
    print(x + y)

else:
    print(1 + k)