qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import math


def solution(K, A, B):
    if A >= B - 2:
        return K
    iterTmp = (K - (A - 1))
    return math.floor(iterTmp / 2) * (B - A) + A + iterTmp % 2


if __name__ == "__main__":
    K, A, B = [int(s) for s in input().split(' ')]
    print(solution(K, A, B))


Fixed code:
import math


def solution(K, A, B):
    if A >= B - 2:
        return K + 1
    iterTmp = K - (A - 1)
    return math.floor(iterTmp / 2) * (B - A) + A + iterTmp % 2


if __name__ == "__main__":
    K, A, B = [int(s) for s in input().split(' ')]
    print(solution(K, A, B))
Buggy code:
k,a,b=map(int,input().split())
bis=1
coin=0
if b-a<=2:
    print(k+1)
else:
    print(((k-(a-1)-2)//(a+2))*b+((k-(a-1)-2)%(a+2))+b)

Fixed code:
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)
Buggy code:
K,A,B=map(int,input().split())
bis=1
if K==1:
  bis=2
elif A>=B-1:
  bis=K+1
else:
  if int((K-(A-1)))%2==0:
    bis=int(A+(B-A)*(K-(A-1))/2)
  else:
    bis=int(A+(B-A)*((K-(A-1))//2)+1)
print(int(bis))

Fixed code:
K,A,B=map(int,input().split())
bis=1
if K==1:
  bis+=1
elif A>=B-1 or K-A+1<=0:
  bis+=K
else:
  if (K-(A-1))%2==0:
    bis=A+(B-A)*((K-(A-1))//2)
  else:
    bis=A+(B-A)*((K-(A-1))//2)+1
print(bis)
Buggy code:

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

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


Fixed code:

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

if B <= A + 2 or K < A+1:
    print(K+1)
else:
    print((B-A)* ((K+1-A) //2 -1)+ B + (K+1-A) % 2)
Buggy code:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
k,a,b=IL()
ans=1
if a>=b:
    ans=1+k
else:
    if b-a<=2:
        ans=1+k
    else:
        if a-1+2>k:
            ans=1+k
        else:
            k=k-(a+1)
            ans=b
            ans+=(k//(a+2))*b+k-(k//(a+2))*(a+2)
print(ans)

Fixed code:
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return input()
k,a,b=IL()
ans=1
if a>=b:
    ans=1+k
else:
    if b-a<=2:
        ans=1+k
    else:
        if a-1+2>k:
            ans=1+k
        else:
            k=k-(a+1)
            ans=b
            ans+=(k//2)*(b-a)+k%2
print(ans)
Buggy code:
k,a,b = map(int,input().split())
add = b - a
ans = 1
if k <= a - 1:
    ans = 1 + k
    print(ans)
else:
    ans = a
    k = k - (a-1)
    if b > a:
        ans += add*(k//2) + k%2
        print(ans)
        

Fixed code:
k,a,b = map(int,input().split())
add = b - a
ans = 1
if k <= a - 1:
    ans = 1 + k
    print(ans)
else:
    ans = a
    k = k - (a-1)
    ans += max(add*(k//2) + k%2,k)
    print(ans)
Buggy code:
k,a,b=map(int,input().split())
cnt=1
yen=0

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

else:
    if k>=a+1:
        k-=a+1
        cnt+=b
        q,modulo=divmod(k,a+2)
        cnt+=q*b+modulo
        print(cnt)
    else:
        print(k)
    

Fixed code:
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)
Buggy code:
def main():
    K,A,B = map(int,input().split())
    if B-A<=2:
        pass
    else:
        print(1+K)
        exit()
    now = 1
    K -= (A-1)
    now = A
    if K%2==0:
        now += (B-A)*(K//2)
    else:
        now += (B-A)*((K-1)//2)
        now += 1
    print(now)  
if __name__ == '__main__':
    main()

Fixed code:
def main():
    K,A,B = map(int,input().split())
    if B-A<=2:
        print(1+K)
        exit()
    now = 1
    K -= (A-1)
    now = A
    if K%2==0:
        now += (B-A)*(K//2)
    else:
        now += (B-A)*((K-1)//2)
        now += 1
    print(now)  
if __name__ == '__main__':
    main()
Buggy code:
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
	print(new_K)
	if new_K % 2 == 1:
		temp_K = int((new_K+1)/2)
		print(temp_K)
		print(int(temp_K*B - (temp_K-1)*A))
	else:
		print(int((new_K/2)*B - ((new_K/2)-1)*A + 1))
		
	

Fixed code:
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)))
Buggy code:
k,a,b=map(int,input().split())

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

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

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

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

s=k+1-a
if a>=b-1:
    print(k+1)
else:
    n=s//2
    m=s%2
    print(a+n*(b-a)+m)
Buggy code:
K,A,B=input().split()
K=int(K)
A=int(A)
B=int(B)

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

print(solve(A,B,K))


Fixed code:
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))
Buggy code:
k,a,b=map(int,input().split())
ans=0
cnt=0
if b<=a+1 or a>k:
  print(k+1)
else:
  print(a+(k-a+1)*(b-a)//2+(k-a+1)*(b-a)%2)
    

Fixed code:
k,a,b=map(int,input().split())
ans=0
cnt=0
if b<=a+1 or a>k:
  print(k+1)
else:
  print(a+((k-a+1)//2)*(b-a)+((k-a+1)%2))
Buggy code:
k, a, b = map(int, input().split())

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

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

max_change = max(0, (k - (a - 1)) // 2)
print(max(k+1, 1+k-max_change*2 + (b-a)*max_change))
Buggy code:
K, A, B = map(int, input().split())

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


Fixed code:
K, A, B = map(int, input().split())
k = K
if A >= B:
    print(K + 1)
else:
    K -= A - 1
    ans = A
    ans += (K // 2) * (B - A)
    ans += K % 2
    print(max(ans, k + 1))
Buggy code:
k,a,b=map(int,input().split())

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


    print(ans)


else:
    print(1+k)


Fixed code:
k,a,b = map(int,input().split())
if b <= a+2:
    print(1+k)
else:
    ans = 0
    k -= a+1
    ans += b
    l = k//2
    ans += b*l - a*l
    ans += k % 2
    print(ans)
Buggy code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random

import os
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    K,A,B = inputMap()
    
    if A+2 >= B:
        print(1+K)
        sys.exit()
        
    sai = A+1
    ans = 1
    if K < sai:
        print(1+K)
        sys.exit()
        
    else:
        sai = A-1
        K = K-sai
        
        if K % 2 == 1:
            K -= 1
            ans = 1
            kai = K / 2
            ans += (B-A)*kai
            ans += A
            
        else:
            kai = K / 2
            ans = (B-A)*kai
            ans += A
        
    print(int(ans))
    #print(48518828981938099)
    
    
if __name__ == "__main__":
	main()


Fixed code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random

import os
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    K,A,B = inputMap()
    
    if A+2 >= B:
        print(1+K)
        sys.exit()
        
    sai = A+1
    ans = 1
    if K < sai:
        print(1+K)
        sys.exit()
        
    else:
        sai = A-1
        K = K-sai
        
        if K % 2 == 1:
            K -= 1
            ans = 1
            kai = int(K / 2)
            ans += (B-A)*kai
            ans += A
            
        else:
            kai = int(K / 2)
            ans = (B-A)*kai
            ans += A
        
    print(ans)
    #print(48518828981938099)
    
    
if __name__ == "__main__":
	main()
Buggy code:
# import sys
# input = sys.stdin.readline
# import re
import collections
import bisect
import math
import fractions
import collections
import itertools
from functools import reduce

def main():
    k, a, b = input_list()
    if b - a > 2:
        d = min(a - 1, k)
        r = k - d
        ans = (r/2)*(b-a)
        print(ans + (k % 2))
    else:
        print(k+1)


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


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


if __name__ == '__main__':
    main()



Fixed code:
# import sys
# input = sys.stdin.readline
# import re
import collections
import bisect
import math
import fractions
import collections
import itertools
from functools import reduce

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


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


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


if __name__ == '__main__':
    main()
Buggy code:
K, A, B = map(int, input().split())
if A >= 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)

Fixed code:
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)
Buggy code:
k, a, b = map(int, input().split())
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, k+1)

print(int(ans))


Fixed code:
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))
Buggy code:
def main():
  K, A, B = map(int, input().split())

  if ((B-A) <= 2):
    print(str(K+1))
    return
  
  if (K < (A - 1 + 2)):
    print(str(K+1))
    return
  
  r = K - (A - 1)
  a = r // 2

  print(a*(B-A) + A)

main()



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

  if ((B-A) <= 2):
    print(str(K+1))
    return
  
  if (K < (A - 1 + 2)):
    print(str(K+1))
    return
  
  r = K - (A - 1)
  a = r // 2
  b = r % 2

  print(a*(B-A) + A + b)

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


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

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

Fixed code:
k,a,b = map(int,input().split())
if a+2 >= b or a >= k:
    print(k+1)
else:
    k -= a-1
    print(a+ (b-a)*(k//2) + k%2)
Buggy code:
k,a,b=map(int,input().split())
ans=0
if a+1<k and b>a+2:
  k=k-(a+1)
  ans+=b
  mul,mod=divmod(k,2)
  ans+=(mul)*(b-a)
  ans+=mod
  print(ans)
else:
  print(ans+k)


Fixed code:
k,a,b=map(int,input().split())
ans=0
if a+1<=k and b>a+2:
  k=k-(a+1)
  ans+=b
  mul,mod=divmod(k,2)
  ans+=(mul)*(b-a)
  ans+=mod
  print(ans)
else:
  print(1+k)
Buggy code:
n,a,b = map(int,input().split())
n += 1
if a+2<=b and n>=a+2:
  x = n//(a+2)
  y = n%(a+2)
  ans = x*b+y
else:
  ans = n
print(ans)

Fixed code:
n,a,b = map(int,input().split())
n += 1
if a+2<=b and n>=a+2:
  x = n-(a+2)
  y = x//2
  z = x%2
  ans = b+y*(b-a)+z
else:
  ans = n
print(ans)
Buggy code:
k,a,b=map(int,input().split())
if b-a<=2:
  print(k+1)
else:
  p=k+1-a
  if p%2==0:
    print(p*(b-a)//2)
  else:
    print((p-1)*(b-a)//2+1)

Fixed code:
k,a,b=map(int,input().split())
if b-a<=2:
  print(k+1)
else:
  p=k+1-a
  if p<=0:
    print(k+1)
  elif p%2==0:
    print(p*(b-a)//2+a)
  else:
    print((p-1)*(b-a)//2+a+1)
Buggy code:
k,a,b=map(int,input().split())
if a+2>=b:print(k+1)
elif a>=k:print(k+1)
else:
    k-=a-1
    ans=a+(b-a)*k//2
    if k%2==1:print(ans+1)
    elif k%2==0:print(ans)


Fixed code:
k,a,b=map(int,input().split())
if a+2>=b:print(k+1)
elif a>=k:print(k+1)
else:
    k-=(a+1)
    ans=b+(b-a)*(k//2)
    if k%2==1:print(ans+1)
    elif k%2==0:print(ans)
Buggy code:
K, A, B = map(int, input().split())

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

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

if(B-A <= 2):
    print(K+1)
else:
    m = max(0, (K-(A-1))//2)*(B-A)+(K+1)-2*max(0, (K-(A-1))//2)
    print(m)
Buggy code:
k, a, b = map(int, input().split()) 
biscet = 1

rate = (b-a)/2

if ( rate > 1):
    k-=(a-1)
    biscet+=(a-1)
    biscet += int(k/2) * (b-a)
    biscet += k%2
    
else:
    biscet += k    

Fixed code:
k, a, b = map(int, input().split()) 
biscet = 1

rate = (b-a)/2

if ( rate > 1):
    k-=(a-1)
    biscet+=(a-1)
    biscet += int(k/2) * (b-a)
    biscet += k%2
    
else:
    biscet += k    

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

Fixed code:
K,A,B=map(int,input().split())
if B-A<=2:
  print(K+1)
else:
  if A-1>=K:
    print(K+1)
  else:
    if (K-(A-1))%2:
      print(A+1+(B-A)*((K-A)//2))
    else:
      print(A+(B-A)*((K-A+1)//2))
Buggy code:
k,a,b = map(int,input().split())
if a+2 >=b:
    print(k+1)
else:
    if k-(a-1) % 2 == 0:
        print((k-(a-1))/2*(b-a) + a)
    else:
        print(int((k-(a-1))/2)*(b-a) + a + 1)

Fixed code:
k, a, b = map(int, input().split())
if (a + 2 >= b):
  print(k + 1)
else:
  bisc = a
  k -= a - 1
  bisc += (b - a) * (k // 2)
  if (k % 2):
    bisc += 1
  print(bisc)
Buggy code:
K,A,B=map(int,input().split())
ans=1
if K==1:
  ans+=1
elif A>=B-1 or K-A+1<=0:
  ans+=K
else:
  if (K-(A-1))%2==0:
    ans=int( A+(B-A)*( (K-A+1)/2 ))

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

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

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

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

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

if (B - A) <= 2:
    print(K + 1)
elif K <= A:
    print(K + 1)
else:
    M = K - A + 1
    ans = A + M // 2 * (B - A) + M % 2
    print(ans)
Buggy code:
k,a,b = map(int,input().split())
bis = 1
cnt = 0
if 1+k<a or b-a<=2 or a>b:
    bis = 1+k
if (k-(a-1))%2==0:
    bis = (b+(b-a)*((k-(a-1))//2-1))
else:
    bis = (a-1)+(b+(b-a)*((k-(a-1))//2-1))
print(bis)

Fixed code:
k,a,b = map(int,input().split())
bis = 0
if abs(a-b)<=1 or a>b:
  print(k+1)
else:
  k = k - a - 1
  bis += b
  bis += k//2*b-k//2*a
  print(bis+k%2)
Buggy code:
K,A,B = (int(x) for x in input().split())

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


Fixed code:
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)))
Buggy code:
import numpy as np

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

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

Fixed code:
import numpy as np

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

if A+1>=B or K<A+1:
    print(K+1)
else:
    ex = (K-A+1)//2
    res= (K-A+1)%2
    # print(ex)
    # print(res)
    print(A+ex*(B-A)+res)
Buggy code:
K,A,B = map(int,input().split())

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

Fixed code:
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)
Buggy code:
k,a,b=map(int,input().split())
if b-a<=1 or a>=k:print(k+1)
elif (k-a+1)%2==0:print(a+(b-a)*((k-a+1)/2))
else:print(a+1+(b-a)*((k-a+1)//2))

Fixed code:
k,a,b=map(int,input().split())
if b-a<=1 or a>=k:print(k+1)
elif (k-a+1)%2==0:print(int(a+(b-a)*int((k-a+1)/2)))
else:print(int(a+1+(b-a)*int((k-a)/2)))
Buggy code:
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)

Fixed code:
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)
Buggy code:
K,A,B = map(int,input().split(' '))

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

print(ans)




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

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

print(ans)
Buggy code:
#B
"""
def find(x):
    while table[x] >= 0:
        x = table[x]
    return x

def union(x, y):
    s1 = find(x)
    s2 = find(x)
    if s1 != s2:
        if table[s1] != table[s2]:
            if table[s1] < table[s2]:
                table[s2] = s1
            else:
                table[s1] = s2
        else:
            table[s1] -= 1
            table[s2] = s1
    return
    


a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())

ans = [0 for i in range(4)]

ans[a1-1] += 1 
ans[a2-1] += 1 
ans[a3-1] += 1 
ans[b1-1] += 1 
ans[b2-1] += 1 
ans[b3-1] += 1 

if 0 in ans or 3 in ans:
    print("NO")
else:
    print("YES")
"""

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

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

Fixed code:
#B
"""
def find(x):
    while table[x] >= 0:
        x = table[x]
    return x

def union(x, y):
    s1 = find(x)
    s2 = find(x)
    if s1 != s2:
        if table[s1] != table[s2]:
            if table[s1] < table[s2]:
                table[s2] = s1
            else:
                table[s1] = s2
        else:
            table[s1] -= 1
            table[s2] = s1
    return
    


a1, b1 = map(int, input().split())
a2, b2 = map(int, input().split())
a3, b3 = map(int, input().split())

ans = [0 for i in range(4)]

ans[a1-1] += 1 
ans[a2-1] += 1 
ans[a3-1] += 1 
ans[b1-1] += 1 
ans[b2-1] += 1 
ans[b3-1] += 1 

if 0 in ans or 3 in ans:
    print("NO")
else:
    print("YES")
"""

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

if a + 1 >= b:
    print(k + 1)
else:
    ans = k - 2*((k-(a-1))//2) + 1 + (b-a) * ((k - (a - 1)) // 2)
    print(ans)
Buggy code:
K,A,B = input().split()
K = int(K)
A = int(A)
B = int(B)
bi = 1

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

Fixed code:
K,A,B = input().split()
K = int(K)
A = int(A)
B = int(B)
bi = 1

if(B-A<=2):
    bi+=K
else:
    bi=A
    #print(bi)
    K1=K-(A-1)
    #print(K-(A-1))
    bi+=((K1)//2)*(B-A)
    #print(((K1)//2)*(B-A))
    bi+=((K1)%2)
    #print(((K1)%2))
print(bi)
Buggy code:
k, a, b = map(int, input().split())
if b - a <= 2:
    print(k + 1)
else:
    cnt = k - (a - 1)
    print(max(k + 1, (b - a) * cnt // 2 + 1 * cnt % 2 + a))

Fixed code:
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))
Buggy code:
k, a, b = map(int, input().split())

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

Fixed code:
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))
Buggy code:
k, a, b = map(int, input().split())
if b - a <= 2 or a >= k:
    print(k + 1)
else:
    cnt = k - (a - 1)
    print((b - a) * cnt // 2 + 1 * cnt % 2 + a)

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

def f(k,a,b):
    bsk = 1
    if (a+1)>=b or (k<(a+1)):
        bsk += k
        print(bsk)
        return
    else:
        k -= (a-1)
        bsk = a
    
    if k>=2:
        if k%2==0:
            bsk += (b-a)*(k/2)
        else:
            bsk += (b-a)*((k-1)/2)+1
    
        print(int(bsk))
        return
    else:
        bsk +=k
        print(int(bsk))
        return
    
    
f(k,a,b)

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

def f(k,a,b):
    bsk = 1
    if (a+1)>=b or (k<(a+1)):
        bsk += k
        print(bsk)
        return
    else:
        k -= (a-1)
        bsk = a

    if k>=2:
        if k%2==0:
            bsk += (b-a)*(k//2)
        else:
            bsk += (b-a)*((k-1)//2)+1
    
    print(int(bsk))
    
    
f(k,a,b)
Buggy code:
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+1)
        else:
            print(b+(b-a)*(k-a-1)//2)

Fixed code:
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)
Buggy code:
k,a,b=map(int,input().split())
if a>=b:
    print(k+1)
else:
    if k>=a+1:
        k=k-a-1
        r=k%2
        c=(b)+(b-a)*(k//2)+r
        print(c)
    else:
        print(k+1)


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