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
input = sys.stdin.readline


def read():
    K, A, B = list(map(int, input().strip().split()))
    return K, A, B


def solve(K, A, B):
    ans = 1
    if B-A <= 1:
        ans += K
        return ans
    if K < A-1:
        ans += K
        return ans
    ans += (A-1)
    k = K-A+1
    ans += (B-A) * (k//2) + k % 2
    return ans


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))

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

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

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
import sys
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

k,a,b = MAP()
if(b-a<=1):
    ans = 1 + k
else:
    n = (1+k-a)//2
    ans = 1 + k - 2*n + (b-a)*n
print(ans)

Solution (Python):
import sys

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

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

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

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

ans = 1
if A >= B:
    ans += K
else:
    restk = K
    
    restk -= A - 1

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

Solution (Python):









import sys


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


K, A, B = map(int, input().split())
if A - 1 >= K:  
    exit(K + 1)

if B - A > 2:
    
    K -= (A - 1)
    
    times, r = divmod(K, 2)
    print(r + times * (B - A) + A)
else:
    print(K + 1)

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

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

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

Solution (Python):

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

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

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

ans=0

if a+1>=b or k<=a:
    ans=k+1
else:
    k-=(a-1)
    ans=a
    exchange=k//2
    ans+=(b-a)*exchange

    k-=2*exchange
    ans+=k

print(ans)

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

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

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





def main():
    k, a, b = input_list()
    
    if b-a <= 2:
        print(k+1)
    else:
        bis = a
        k -= a-1
        if k % 2 == 1:
            bis += 1
            k -= 1
        bis += (b-a)*(k//2)
        print(bis)


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()

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

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

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

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

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

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

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

if cur + k <= a+1:
  print(cur + k)
  exit()

cur, k, = a, k-a+cur

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

cur += k
print(cur)

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


if b-a <= 2:
    print(1+k)
else:
    k -= a-1
    q,r = divmod(k,2)
    print(a+q*(b-a)+r)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7


K, A, B = MAP()

if A+1 >= B or A >= K:
	print(1 + K)
else:
	ans = A
	K -= A-1
	n, left = divmod(K, 2)
	ans += n*(B-A) + left
	print(ans)

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

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

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

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

if a >= b:
    ans = k + 1
    print(ans)
    exit()

if (a - 1) >= k:
    ans = k + 1
    print(ans)
    exit()

ans = 1
ans += a - 1
q, r = divmod(k - (a - 1), 2)
ans += (b - a) * q
ans += r
ans = max(ans, k + 1)

print(ans)

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

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

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








if (K == 1):
    print(K + 1)
    exit()

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

elif (A < B):
    
    nokori = K - (A - 1)
    bis = A
    for _ in range(A):
        if (nokori % 2 != 0):
            nokori -= 1
            bis += 1
        else:
            break

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

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

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

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

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

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

    rest=k-(a-1)


    exc=rest//2

    bis=(exc*b - (exc-1)*a)

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

    print(bis)

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

st = max(0, (k-(a-1))//2)

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

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

Solution (Python):
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
import sys,bisect,string,math,time,functools,random
def Golf():*a,=map(int,open(0))
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[];g=[[] for i in range(n)]
    for i in range(E):
        inp=LI();org_inp.append(inp)
        if index==0:inp[0]-=1;inp[1]-=1
        if len(inp)==2:
            a,b=inp;g[a].append(b)
            if not Directed:g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp;aa=(inp[0],inp[2]);bb=(inp[1],inp[2]);g[a].append(bb)
            if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,boundary=1,search=[],replacement_of_found='.',mp_def={'

    mp=[boundary]*(w+2);found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def bit_combination(k,n=2):return [[tb//(n**bt)%n for bt in range(k)] for tb in range(n**k)]
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)
def show2d(g,h,w):
    for i in range(h):show(g[i*w:i*w+w])

YN=['YES','NO'];Yn=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase

input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True




k,a,b=LI()

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

print(ans)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7


K, A, B = MAP()

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

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

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


print(int(ans))

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

    if A >= B:
        ans = K + 1
    else:

        if abs(A - B) <= 2:
            ans = K + 1

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

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

    print(ans)

if __name__ == "__main__":
    main()

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

print(max(bis,tempbis))

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

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

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

Solution (Python):
import sys

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


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

    if b - a < 2 or k - a < 1:
        print(k + 1)
    else:
        k -= a - 1
        q, k = divmod(k, 2)
        res = a + q * (b - a) + k
        print(res)


if __name__ == '__main__':
    resolve()

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

ans=1
cnt=0
if a>=b-1:
    print(ans+k)
    exit(0)

cnt += (a-ans)
ans += (a-ans)



n = (k-cnt)//2
ans-= a * n
ans+= b * n
cnt+= 2 * n


ans += k-cnt

print(ans)

Solution (Python):






import sys
input = sys.stdin.readline

import math

import bisect
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache






MOD = 10**9+7
INF = float('inf')






def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]


def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()


def DD(arg): return defaultdict(arg)



def inv(n): return pow(n, MOD-2, MOD)


kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret


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 make_divisors(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i: 
        divisors.append(n//i)
  return divisors


def make_primes(N):
  max = int(math.sqrt(N))
  seachList = [i for i in range(2,N+1)]
  primeNum = []
  while seachList[0] <= max:
    primeNum.append(seachList[0])
    tmp = seachList[0]
    seachList = [i for i in seachList if i % tmp != 0]
  primeNum.extend(seachList)
  return primeNum


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


def lcm(a, b):
    return a * b // gcd (a, b)


def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count


def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))


def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count




K,A,B = IL()

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

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

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

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

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

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

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

if a>=b:
  print(k+1)
  exit()

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

else:
  n=(k-(a-1))

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

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

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






biscuits = 1
if b - a > 2:
    
    
    if a - 1 > k:
        
        biscuits += k
    else:
        
        biscuits += a - 1
        k -= a - 1
        if k > 0:
            times = k // 2
            rest = k - times * 2
            biscuits += (b - a) * times
            biscuits += rest
else:
    
    biscuits += k

print(biscuits)

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

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

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

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

chage_turn = 2
ans = 0
K -= A - 1 + chage_turn
ans += B
ans += K//2 * (B-A) + K%2
print(ans)

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

if __name__ == "__main__":
    main()

Solution (Python):
k, toayen, fromayen = map(int, input().split())
ans1 = k + 1
k -= (toayen - 1)
d, m = divmod(k, 2)
ans2 = (fromayen - toayen) * d + toayen + m
print(max(ans1, ans2))

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

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

Solution (Python):
k,a,b = map(int,input().split())
k -= a-1
div,mod = divmod(k,2)
ans = 1 + (a-1)
if a+2 <= b:
    dum = b-a
    ans += dum*div
    if mod == 1:
        ans += 1
else:
    ans += k
print(ans)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    K,A,B = map(int,input().split())
    if B - A >= 2:
        K -= A - 1
        ans = A + (B - A) * (K//2) + K%2
    else:
        ans = K + 1
    print(ans)
if __name__ == '__main__':
    main()

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

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

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

Solution (Python):


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

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

    print(c)

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

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

ans = 1

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

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

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

K -= A - 1
res = A

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

if K % 2 == 1:
    res += 1

print(res)

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

if B-A<=2:
    b_count+=K
else:
    b_chenge_count=max(0,int((K-(A-1))/2))
    b_count+=b_chenge_count*(B-A)+(A-1)+(K-(A-1)-b_chenge_count*2)

print(b_count)

Solution (Python):

K,A,B=map(int,input().split())
b_count=1
b_chenge_count=0

if B-A<=2:
    b_count+=K
else:
    b_chenge_count=max(0,int((K-(A-1))/2))
    b_count=b_chenge_count*(B-A)+(A)+(K-(A-1)-b_chenge_count*2)

print(b_count)

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

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

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

print(ans)

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

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

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

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

Solution (Python):


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

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

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

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

print(ans)

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

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

print(ans)

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

if K == 1:
    print(2)
elif K == 2:
    if A == 1 and B >= 2:
        print(B)
    else:
        print(2)
else:
    ans = 1
    
    if B-A >= 2:
        
        cnt, amari = divmod(K-(A-1), 2)
        ans = A+cnt*(B-A)+amari
    else:
        ans += K
    print(ans)

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

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

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

Solution (Python):
K,A,B = map(int,input().split())
if B<=A+2 or K<=A-1:
    ans = 1+K
else:
    cnt = A-1
    ans = A
    while cnt<=K:
        k = min(ans//A,(K-cnt)//2)
        if k>=1:
            cnt += 2*k
            ans = ans-k*A + k*B
        else:
            ans += (K-cnt)
            break
print(ans)

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

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

if 2 < (b-a):
    if k-(a-1) >= 2:
        q, r = divmod(k-(a-1), 2)
        ans = (b-a)*q+r+a
    else:
        ans = k+1

else:
    ans = k+1

print(ans)

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

if B - A >= 2:
    n_0 = A - 1
    n_1 = (K - n_0) // 2
    ans = 1 + n_1 * (B - A) + (K - 2 * n_1) * 1
else:
    ans = 1 + K

print(ans)

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

Solution (Python):
from sys import stdin
def main():
    
    readline=stdin.readline
    k,a,b=map(int,readline().split())
    cnt=1
    if a>=b-1:
        cnt+=k
    else:
        if k<a-1:
            cnt+=k
        else:
            cnt=a
            k-=a-1

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

if __name__=="__main__":
    main()

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

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

biscuits = 0

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

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

print(biscuits)

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

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

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

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

Solution (Python):
def resolve():
    K,A,B = map(int,input().split())
    if A>=B or K<=A:
        print(K+1)
        return
    
    nokori = K-A+1
    diff = B-A

    sc = A+ + diff*(nokori//2) +(1 if nokori%2 ==1 else 0)
    print(max(sc,K+1))
resolve()

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

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

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

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

ans = 1
if (B-A) <= 2:
  ans += K

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

print(ans)

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

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

if K < A+1 or B <= A+2:
  print(K+1)
  exit(0)
  
K -= A - 1
ans = A
p,q = divmod(K,2)
ans += (B-A) * p + q
print(ans)

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


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

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

ans = 1
yen = 0
if A+1 >= B:
    print(K+1)
    quit()
cycle = max(0, (K-(A-1))//2)
res = (K-(A-1)) % 2
ans = cycle * (B-A) + A + res
print(ans)

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

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

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

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

cost = 0

if b-a <= 2 or k < a-1:
    print(k+1)
else:
    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 b > a + 1:
    ans = (k - a + 1) // 2 * (b - a) + a
    print(ans if (k - a + 1) % 2 == 0 else ans + 1)
if b <= a + 1:
    print(k + 1)