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

import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement


from operator import itemgetter
from sys import stdin

from operator import mul
from functools import reduce
from collections import Counter





j=0
k=0
n=3
r=1
a=[0]






"1行1つの整数を入力を取得し、整数と取得する"




"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

for i in number_list:
    print(number_list[i-1])

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''



"正方行列にstr型の値を入力"
'''




'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"


'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''











'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''




"aという変数に入っているものを大文字にして出力"

















'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''


'''
def cmb(n,r):
    
    r= min(n-r,r)
    
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    
    
    

    under = reduce(mul, range(1, r+1))
    
    
    
    

    return over // under
    
    
    
    
a = cmb(n, r)

'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD

combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''




for i in a.most_common(n):print(i)





 


'''









'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''

'''
素数の判定
'''


def is_prime(n):
    if n == 1: return False

    for k in range(2, int(np.sqrt(n)) + 1):
        
        if n % k == 0:
            return False
            
    return True


'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります．[1, -2, 3]と0の4つの数字のうち，最も大きい値を出力します．

一方で，[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります．
その時は，numpyのmaximum関数を用います．

xs = np.array([1, -2, 3])
np.maximum(xs, 0)  

'''

def factorial(x, mod=10**9+7):
    
    
    
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp
    '''
    Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.
    But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.
    '''











'''
ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits = '0123456789'
hexdigits = '0123456789abcdefABCDEF'
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv...\xaf\xb0...
lowercase = 'abcdefghijklmnopqrstuvwxyz'
octdigits = '01234567'
printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU...
punctuation = '!"
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
whitespace = '\t\n\x0b\x0c\r '
'''
'''
引数endに任意の文字列を指定すると、その文字列が改行の代わりに最後に挿入される。例えば連続するprint()の出力を改行なしで単純に連結したい場合は空文字列''を指定すればよい。

print('abc', end='---')
print('xyz')


print('abc', end='')
print('xyz')

source: print_basic.py
なお、デフォルトで改行されるのは引数endのデフォルト値が改行文字'\n'に設定されているから。
'''

def main():
    n=3
    steps=0
    state=0
    w=1
    j=0
    k=0
    sum=0
    
    
    k,a,b=map(int, input().split(" "))
    if a>b :
        print(k+1)
    elif a<=b and abs(b-a)<=2:
        print(k+1)
    else:
        
        n=k-(a-1)
        n=n//2
        odd=(k-(a-1))%2
        
        sum=a
        
        sum=sum+(b-a)*n
        if odd==1:
            sum=sum+1
        print(sum)
    
    
    
    
    
    
    
    


    
    
     

    l = ['aaa', 'bbb', 'ccc']
    x=l.index('aaa')
    
    
    
    

    
        
    
    

    
    
    
    
    DP = np.zeros(w+1, dtype=int)
    exdp=np.zeros((3,4)) 
    
    
    
        
        
    
    
        
        
    


    
    



    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]
    

    ls = ["a", "b", "c", "d", "e"]


    
    

    
    

    
    
    
    
    
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

Solution (Python):


import sys
input= lambda: sys.stdin.readline().rstrip()
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))

def resolve():
    K,A,B=pin()
    t=(B-A)/2
    if K<A or B-A<=2:
        print(K+1)
        return
    K-=(A-1)
    cnt=A
    p,q=K%2,K//2
    cnt+=(B-A)*q+p
    print(cnt)


resolve()

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

def resolve():
    k,a,b=map(int, input().split())
    ans=0
    if b-1>a+1 and k>=a+1:
        k-=a+1
        ans+=b
        ans+=max(k//2*(b-a)+k%2,k//(a+2)*b+k%(a+2))
        print(ans)

    else:
        print(1+k)
resolve()

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

upbis = 0
k = K - A + 1
if B > A:
    upbis = A + (k // 2) * (B-A) + (k % 2)

print(max(1+K, upbis))

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

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

if 1 + k <= a or b - a <= 2:
    print(1 + k)
else:
    cnt = (k - (a - 1)) // 2
    mod = (k - (a - 1)) % 2
    ans = (b - a)*cnt + a + mod
    print(max(ans, k + 1))

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

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

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

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

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

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

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

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

ans = max(ans,(k-(a-1))//2*(b-a)+(k-(a-1))%2+a)

print(ans)

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

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


count = A
K -= (A - 1)


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

count += K % 2
print(count)

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


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

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

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

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

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

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

Solution (Python):
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

k,a,b = MI()

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

Solution (Python):
N,A,B = list(map(int,input().split()))
another=1+1*N
ans =A
N -= A-1
ans += N//2 * (B-A)
ans += N%2
print(max(ans,another))

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

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

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

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

k,a,b = iim()
if k == 1 or b-a <= 2:
    print(1+k)
else:
    rem = k-a-1
    if rem%2 == 0:
        print(b+(b-a)*(rem//2))
    else:
        print(b+(b-a)*(rem//2)+1)

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

Solution (Python):
import sys

input = sys.stdin.readline


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

    if A + 2 < B:
        if A - 1 <= K:
            K -= (A - 1)
            ans = A
            q, r, = divmod(K, 2)
            ans += (B - A) * q + r
        else:
            ans = 1 + K
    else:
        ans = 1 + K

    print(ans)


if __name__ == "__main__":
    main()

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

bisket = 1
money = 0

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

print(bisket)

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

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

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

Solution (Python):
import sys
import re
import math
import collections
import decimal
import bisect
import itertools

import copy






INF = sys.maxsize
MOD = 10 ** 9 + 7

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))





def main():
    k, a, b = ns()
    ans = 0
    if b - a < 2:
        ans = k + 1
    else:
        if k - a <= 0:
            ans = k + 1
        else:
            ans = a + (k + 1 - a) // 2 * (b-a) + (k + 1 - a) % 2

    print(ans)


if __name__ == '__main__':
    main()

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

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

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

ans = a + (b - a) * ((k - a + 1) // 2)
if (k - a) % 2 == 0:
    ans += 1
print(max(k + 1, ans))

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

if b - a <= 2 or k < a -1:
	print(k + 1)
	exit()

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

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

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

n = 1 + K
x = 1
if K > A:
	x = B
	K -= A+1

	temp = int(K / 2)

	x += temp * (B-A)
	K -= temp * 2

	while K > 0:
		K -= 1
		x += 1

print(max(x, n))

Solution (Python):
k,a,b = map(int,input().split())
ans = 1
cnt = 0
m = 0

if a-1 >= k:
    print(k+1)
else:
    cnt += a-1
    ans += a-1
    if a+2 < b:
        m = k - cnt
        cnt += (m // 2) * 2
        ans += (b-a) * (m // 2)

        if cnt != k:
            ans += 1
        print(ans)
    else:
        print(k+1)

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

t = k
cnt = 1


if a+1<b:
    
    cnt += a-1
    t -= a-1
    
    
    
    cnt += b*math.floor(t/2)
    cnt -= a*math.floor(t/2)
    t -= 2 * math.floor(t/2)
    
    
    
    cnt += t
else:
    cnt +=k
print(cnt)

Solution (Python):
k,a,b = map(int,input().split())
ans = 1
cnt = 0
m = 0

if a-1 >= k:
    print(k+1)
else:
    cnt += a-1
    ans += a-1
    if a+2 < b:
        m = k - cnt
        cnt += (m // 2) * 2
        ans += (b-a) * (m // 2)

        if cnt != k:
            ans += 1
        print(ans)
    else:
        print(k+1)

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

if a > b:
    print(1+k)
    exit()
kk = k
kk -= a - 1
ans = a + (kk // 2) * (b - a) + (kk % 2)

print(max(ans, 1+k))

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

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

Solution (Python):


import math


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


koho_1 = 1 + K
koho_2 = 0
if B-A>2:
    koho_2 = A
    K -= A - 1
    if K%2==1:
        koho_2 += 1
        K -= 1
    koho_2 += (B - A) * (K // 2)


ans = max(koho_1, koho_2)


print(ans)

Solution (Python):
import math
import sys

k, a, b = map(int, sys.stdin.readline().rstrip().split())

if b - a <= 2:
    print(k + 1)
else:
    t = max(0, (k - a + 1) // 2)
    print(k + 1 + t * (b - a - 2))

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

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

Solution (Python):
K, A, B = (int(_) for _ in input().split())
ret = K + 1
if B - A - 2 > 0:
  c = max((K - A - 1)//2 + 1, 0)
  ret += c * (B - A - 2)
print(ret)

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

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

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

Solution (Python):
import math
def myAnswer(K:int,A:int,B:int) -> int:
   if(K <= A-1): return K+1
   tmp =(K - (A-1))
   
   ans = (B - A) * math.floor(tmp//2) + tmp % 2 + A
   
   return max(ans,K+1)



def modelAnswer():
   return
def main():
   K,A,B = map(int,input().split())
   print(myAnswer(K,A,B))
if __name__ == '__main__':
   main()

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

if b-a <= 2:
    print(1+k)
    exit()
    
check = 0
ans = 1

while True:
    if check == 0:
        if (k-2) >= a-1:
            k = k-2-(a-1)
            ans -= 1
            ans += b
            check = 1
            continue
        else:
            ans += k
            break
    else:
        if k % 2 == 0:
            s = k//2
            ans -= a * s
            ans += b * s
        else:
            s = k//2
            ans -= a * s
            ans += b * s + 1
    break

print(ans)

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from fractions import gcd
from math import factorial, sqrt, ceil
from functools import lru_cache, reduce
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)


class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)


def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True



def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret



k, a, b = map(int, input().split())
x = min(k, a)
k = max(0, k - a + 1)
x += max(b - a, 2) * (k // 2) + k % 2 
print(x)

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


        ans = max(ans, kk+1)

print(int(ans))

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

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

Solution (Python):
import sys

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


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

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


if __name__ == '__main__':
    resolve()

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

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

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

Solution (Python):

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

n1 = 1 + K

m = (K - A + 1) // 2
if m <= 0:
    print(n1)
    exit()

n2 = A + (B - A) * m
n2 +=  (K - A + 1) - (2 * m)

print(max(n1, n2))

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

c = b-a

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

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

Solution (Python):
def myAnswer(K:int,A:int,B:int) -> int:
   if((B - A) <=2):
      return K + 1
   else:
      return max(0,(K - (A - 1)) // 2)*(B - A) + A + (K - (A - 1)) % 2


def modelAnswer():
   return
def main():
   K,A,B = map(int,input().split())
   print(myAnswer(K,A,B))
if __name__ == '__main__':
   main()

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

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

Solution (Python):
















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

ans1 = 1 + K
zanturn = K - (A - 1)
AtoB,mod = divmod(zanturn,2)
ans2 = A + (B-A)*AtoB + mod

ans = max(ans1,ans2)

print(ans)

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


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

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

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

Solution (Python):


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

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

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

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

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

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

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

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

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

if 1+(K-2) < A:
    print(K+1)
    exit(0)

exchange_times, last = divmod(K-(A-1), 2)
profit = B - A
ans = A + exchange_times * profit + last
print(ans)

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


def get_max_biscuits():
	
	if K < A + 1:
		return K + 1
	else:
		count = K - (A+1)
		
		return B + (B-A)*(count//2) + count%2


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

if B - A >= 2:
	print(get_max_biscuits())
else:
	print(K + 1)

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

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

if b <= a+1 or k <= a:
    print(k+1)
    exit(0)

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

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    K, A, B = map(int, input().split())
    cnt = 0
    if B - A >= 3:
        times = (K - (A - 1)) // 2
        if times >= 1:
            cnt += A
            cnt+=(B-A)*times
            if (K - (A - 1)) // 2 == (K - (A - 1)) / 2:
                pass
            else:
                cnt += 1
        else:
            cnt = 1 + K
    else:
        cnt = 1 + K

    print(cnt)


resolve()

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

  
  if b - a <= 2: return 1 + k

  
  if 1 + (k - 2) < a: return 1 + k

  
  
  
  exchange_times, last = divmod(k-(a-1), 2)
  profit = b - a
  ans = a + exchange_times * profit + last
  return ans

ans = solve()
print(ans)

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

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

if __name__=='__main__':
    main()

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

Solution (Python):
import sys
k,a,b=map(int, input().split())
if a>=b or (a<b and b-a==1):
    bis=1+k
    print(bis)
    sys.exit()
if a<b and (k-a+1)%2==0:
    bis=(b-a)*((k-a+1)//2-1)+b
    print(bis)
    sys.exit()
if a<b and (k-a+1)%2!=0:
    bis=(b-a)*((k-a+1)//2-1)+b+1
    print(bis)

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

cnt=K-A+1
count=cnt//2
cnt=A-1
cnt+=count*2
balance=K-cnt
ans=0
ans+=A
ans+=(B-A)*count
ans+=balance

ans=max(ans,K+1)
print(ans)

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

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

k+=1
"""
ans=0
k-=a
k-=1
k-=1
ans+=b
k-=1
ans-=a
k-=1
ans+=b
k-=b-a
k-=1
k-=1
ans+=b

k+=1
k-=a
print(k)
print((b-a-2))
if k<=(b-a-2):

  
else:
    k=k//(b-a-2)

print(k)
"""

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

else:
    print(k)

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

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

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

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

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

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

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

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

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

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

if 1 > (b-a)*(1/2):
    print(k+1)
    exit()

else:
    n = max(0,(k-(a-1))//2)
    print(n*(b-a)+(k-n*2)+1)

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

l = k - (a - 1)

tmp = a + (b-a) * (l//2) + (l%2)
print(max(k+1, tmp))

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


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

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

l = k - (a - 1)

tmp = a + (b-a) * (l//2) + (l%2)
print(max(k+1, tmp))

Solution (Python):
K, A, B = map(int, input().split())
if K <= A-1+1:
    print(K+1)
    exit()

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

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

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


bis = 1
m = 0
if b - a < 2:
    print(bis + k)
else:
    change = (k - (a - 1)) // 2
    bis += k - change * 2
    bis += change * (b - a)
    print(bis)