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



Sample input:
4 2 6


Sample output:
7

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
if B - A <= 2 :
  print(K + 1)
elif K < A + 1:
  print(K + 1)
elif K == A + 1:
  print(B)
else :
  ans = B 
  count = K - A - 2
  loop = count // (A + 2)
  amari = count % (A + 2)
  if amari == A + 1:
    ans += B * loop + B
  else:
    ans += B * loop + amari + 1
  print(ans)

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
if B - A <= 2 :
  print(K + 1)
elif K < A + 1:
  print(K + 1)
else :
  ans = B 
  count = K - A - 1
  loop = count // (A + 2)
  amari = count % (A + 2)
  ans += B * loop + amari
  print(ans)

Submission status: Wrong Answer

Solution code:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

K,A,B = imn()

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

    print(ans)

Submission status: Wrong Answer

Solution code:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

K,A,B = imn()

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

    print(ans)

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
if A >= B:
    print(K + 1)
    exit()
# A - 1 回叩いて A 枚にする
# 残り K - (A - 1) 回については，A 枚を1 円にして，B 枚のクッキーに増やすを繰り返す．
tmp = K - (A - 1)
cnt = tmp // 2
amari = tmp % 2

ans = cnt * B - (cnt - 1) * A + amari
print(ans)

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
k, a, b = map(int, input().split())
x=k+1
y=0
if b>a:
    c=b-a
    k=k-a-1
    y=c*(k//2-1)+b+(k%2)
print(max(x,y))

Submission status: Wrong Answer

Solution code:
k,a,b = map(int,input().split())
n=1
e=0
for i in range(k):
    if (k-i)%2==0:
        
        if e==1:
            n=n+b
            continue
        if n>=a:
            e=1
            n=n-a
            continue
    else:
        n=n+1
        continue
print(n)

Submission status: Wrong Answer

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

cnt = a 
k -= a-1


ch = k//2 

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

Submission status: Wrong Answer

Solution 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+int((B-A)*(K-(A-1))//2)
  else:
    bis=A+(B-A)*(K-(A-1))//2+1
print(bis)

Submission status: Wrong Answer

Solution 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+int((B-A)*(K-(A-1)))//2
  else:
    bis=A+(B-A)*(K-(A-1))//2+1
print(bis)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution 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(int(bis))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution 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 int((K-(A-1)))%2==0:
    bis=int(A+(B-A)*(K-(A-1))/2)
  else:
    bis=A+(B-A)*int((K-(A-1))//2)+1
print(bis)

Submission status: Wrong Answer

Solution 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 int((K-(A-1)))%2==0:
    bis=int(A+(B-A)*(K-(A-1))/2)
  else:
    bis=A+(B-A)*int((K-(A-1))//2)+1
print(bis)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
K,A,B=map(int,input().split())
bis=1
if K==1:
  bis+=1
elif A>=B-1:
  bis+=K
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(bis)

Submission status: Wrong Answer

Solution code:
K,A,B=map(int,input().split())
bis=1
if K==1:
  bis=2
elif A>=B-1:
  bis=int(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(bis)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
K,A,B=map(int,input().split())
bis=1
if 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))

Submission status: Wrong Answer

Solution code:
K,A,B=map(int,input().split())
bis=1
if A>=B-1:
  bis=K+1
else:
  if (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))

Submission status: Wrong Answer

Solution code:
K,A,B=map(int,input().split())
bis=1
if A>=B-1:
  bis=K+1
else:
  if (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(bis)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
K,A,B=map(int,input().split())
bis=1
if A>=B-1:
  bis=K+1
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)

Submission status: Wrong Answer

Solution code:
K,A,B=map(int,input().split())
bis=1
if A>=B-1:
  bis=K+1
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)

Submission status: Wrong Answer

Solution code:
K,A,B=map(int,input().split())
ans=0
if B-A<=2 or K+1<=A: #ぼったくり
  ans=K+1
else: #notぼったくり
  # A-1回ポケット叩いてA個のビスケットを用意する。A-1/Kつかう
  # B枚に交換してBの方が大きいので交換し続ける。それぞれ2/Kつかう
  # 最後に1回あまればビスケットを1枚増やしとく。1/Kつかう
  t=(K-A+1)//2 #交換する回数
  ans=B*t+(K-A+1)%2
print(ans)

Submission status: Wrong Answer

Solution code:
#入力（後でいじる）
def pin(type=int):
    return map(type,input().split())
    
#どっかで最悪計算量の入力データを用意する関数を作ろう？
"""
"""

#solution:
#input
K,A,B=pin()
if A>=B-2 or K+1<A  :print(1+K)
else:
    #AもBも行う事を前提とする
    #ここでは、2回行動を消費してB-A個のビスケットを獲得する…が。
    #後ろから貪欲でやってみよう。つまり最初からK+1個持ってるところから引き算で…
    p=(1+K-A)//A
    p=0 if p<0 else p
    print(1+K-p*2+p*(B-A))
#print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
if b-a<=2:
    print(1+k)
    exit()
import math
total=1
k-=a-1
total+=a-1
if k%2==1:
    k-=1
    total+=1
x=max(0,math.ceil((k-(a-1))/2))
total+=x*(b-a)
print(total)

Submission status: Wrong Answer

Solution code:
K,A,B = map(int,input().split())
ans = A
cnt = A
money = 0
if (A > B):
  print(K)
else:
  if (K <= A):
    print(K)
  else:
    while K >= cnt:
      if (money):
        ans += B-A
        money -= 1
      else:
        money += 1
        if (K == cnt):
          ans += 1
      cnt += 1
    
print(ans)

Submission status: Wrong Answer

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

num=k//(a+1)
ans=num*max(b-1,a+1)+1+(k-num*(a+1))
print(ans)

Submission status: Wrong Answer

Solution code:
def examA():
    N, K = LI()
    if (N+1)//2>=K:
        print("YES")
    else:
        print("NO")
    return

def examB():
    d = [0]*4
    for _ in range(3):
        a, b = LI()
        a -=1; b -=1
        d[a] +=1
        d[b] +=1
    for i in d:
        if i>=3 or i==0:
            print("NO")
            return
    print("YES")
    return

def examC():
    K, A, B = LI()
    if A+1>=B:
        ans = K+1
        print(ans)
        return
    l = 0; r = K+1
    while(r-l>1):
        # 何回換金できるか
        now = (l+r)//2
        cur = K - now +1 + (l+r)%2
        if cur<A:
            r = now
        else:
            l = now
    ans = K - l + (l//2)*(B-A) +1 + l%2
    print(ans)
    return
def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LFI(): return list(map(float,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
alphabet = [chr(ord('a') + i) for i in range(26)]

if __name__ == '__main__':
    examC()

"""

"""

Submission status: Wrong Answer

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

ans=(b-a)*(k//(a+1))+(k-k//(a+1)) if k>=a+1 else 1+k
print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# 何回目のアタックだよこれ（前回までのは当然読んですら無い）
# 単純にa<bのとき貯めれるだけためて残りをbにぶっこむのじゃ駄目なの?
k, a, b = map(int, input().split())
if a >= b or b - a <= 2:
    # 貯めるだけムダなので全振り
    print(1 + k)
    exit()
x = a  # はじめてa枚貯まってから1円に交換したターン
d = k - x  # x時点での残りターン
print(x, d)
if d == 0:
    # 変えないほうがよかったね
    print(1 + k)
    exit()
if d % 2 == 0:
    # 直前で止めて+1したほうがいい
    print(a + (b - a) * (d // 2) + 1)
else:
    # そのまま交換したほうがいい
    print(b + (b - a) * (d // 2))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    K,A,B = map(int,input().split())
    check = B/A
    if 2<check:
        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()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    K,A,B = map(int,input().split())
    sum = K+1
    count = K
    
    if A +2 >= B or K <= A+1:
        print(K+1)
    else:
        if (K-A+1)%2 == 0:
            sum = (((K-A+1)//2)-1)*(B-A)+B
        else:
            sum = (((K-A+1)//2)-1)*(B-A)+1+B
        print(sum)
main()

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
# C - When I hit my pocket...
k,a,b = map(int,input().split())

bis = 0
k += 1
kk = k

if b>a+2:
    # TLEしたら2部探索
    while k>=a+2:
        k -= a+2
        bis += b
    bis += k
else:
    bis += k
# eee= (kk//a+2)*(b)
# ddd = (314159265//35897934)*384626433
print(bis)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 1. 最後まで円をもってる必要はない（最後に辻褄が合うように使っていく）
# 2. b枚手に入れるまでにa+1ターンかかるので収支の損得が予めわかる
# 3. オーダー的にループする必要はなさそう

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 1回で+1 か2回でA枚-> Bのどちらか
# B / A > 2 なら、可能な限りAB変換して余りの回数を+1
K, A, B = map(int, input().split())

ans = 1

# まずは A枚ビスケットを作る
if K > A - 1:
  ans += A - 1
  K -= A - 1
else:
  print(ans + K)
  exit()

# 残りの回数 B / A > 2なら変換。  
if B / A > 2:
  d, m = divmod(K, 2)
  ans += d * (B - A) + m
else:
  ans += K
print(ans)

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
ans=[k+1,0]
if a+2>=b or a+2>k:
    print(max(ans))
    exit()
ans[1]=a
ans[1]+=(k//2)*(b-a)
ans[1]+=k%2
print(max(ans))

Submission status: Wrong Answer

Solution code:
k,a,b=map(int,input().split())
ans=a+1
if a+2>=b or a+2>k:
    print(ans)
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 1回で+1 か2回でA枚-> Bのどちらか
# B / A > 2 なら、可能な限りAB変換して余りの回数を+1
K, A, B = map(int, input().split())

ans = 1

# まずは A回ビスケットを作る
if K > A:
  ans += A - 1
  K -= A - 1
else:
  print(K)
  exit()

# 残りの回数 B / A > 2なら変換。  
if B / A > 2:
  d, m = divmod(K, 2)
  ans += d * (B - A) + m
else:
  ans += K
print(ans)

Submission status: Wrong Answer

Solution code:
K, A, B = map(int, input().split())
answer = 1
if B - A <= 2:
    #ずっと＋１する場合
    answer += K
else:
    time = A - 1 #A枚最初に手に入る
    if time + 2 > K or B - A < 2:
        answer += K
    else:
        answer += time
        q, mod = divmod(K-time, 2)
        answer += q
        answer += mod
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#C when i hit my pocket
k,a,b=map(int,input().split( ))
if a>=(b-1):
    print(int(1+k))
else:
    if (k-a+1)%2==0:
        print(int(a+(b-a)*(k-a+1)/2))
    else:
        print(int(a+(b-a)*(k-a)/2+1))

Submission status: Wrong Answer

Solution 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*(b-a)+m)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
K, A, B = [int(i) for i in input().split()]
if K + 1 >= A and A + 2 <=B:
    print(((K+1)-A)//2*(B-A) - A + ((K+1)-A)%2)
else:
    print(K+1)

Submission status: Wrong Answer

Solution code:
K, A, B = [int(i) for i in input().split()]
if A + 2 <=B:
    print(((K+1)//(A+2))*B + (K+1)%(A+2))
else:
    print(K+1)

Submission status: Wrong Answer

Solution code:
import sys
def main():
    def input():
        return sys.stdin.readline()[:-1]
    K, A, B = map(int,input().split())
    if A+2 >= B:
        print(K+1)
    else:
        if (K-A+1)%2 == 0:
            print(max(K+1, A+(B-A)*(K-A+1)//2))
        else:
            print(max(K+1, A-1+(B-A)*(K-A+1)//2))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
def main():
    def input():
        return sys.stdin.readline()[:-1]
    K, A, B = map(int,input().split())
    if A+2 >= B:
        print(K+1)
    else:
        if (K-A+1)%2 == 0:
            print(max(K+1, A+(B-A)*(K-A+1)//2))
        else:
            print(max(K+1, 1+(B-A)*(K-A+1)//2))

if __name__ == '__main__':
    main()