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

Solution code:
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:
        # A枚を1円に変換、1円をB枚に変換で行動件を2回使うので2で割る
        cnt, amari = divmod(K-(A-1), 2)
        ans = A+cnt*(B-A)+amari
    else:
        ans += K
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
K, A, B = map(int, input().split())
CNT = K - A + 1     # 最初、A枚になるまでビスケットを増やす
# 残り回数でできるだけAとBを行う
# 残り回数が1余ったならビスケットを増やす
print(max(A + CNT // 2 * (B - A) + CNT % 2, K + 1))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
k,a,b = map(int,input().split())
# first
cost = 0
# 2回でb-a枚ふやせる
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


j=0
k=0
n=3
r=1
a=[0]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    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を複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
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)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
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()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation



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

#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
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
'''



'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
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):
        #sqrt(n)+1以上は考えて約数はないので却下
        if n % k == 0:
            return False
            #割り切れたら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)  # [1, 0, 3]

'''

def factorial(x, mod=10**9+7):
    # x!
    # 階乗
    # ex) factorial(5) = 120
    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.
    '''


########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

'''
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')
# abc---xyz

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

def main():
    n=3
    steps=0
    state=0
    w=1
    j=0
    k=0
    sum=0
    #lenを変数に置くと事故るから注意
    #n=int(input())
    k,a,b=map(int, input().split(" "))#a,bがともに文字列のとき
    if a>b :
        print(k+1)
    elif a<=b and abs(b-a)<=2:
        print(k+1)
    else:
        #print(k,a)
        n=k-(a-1)#交換ループに入るまでのやつ
        n=n//2#交換ループ用
        odd=(k-(a-1))%2
        #print(n,odd)
        sum=a
        #for i in range(n):
        sum=sum+(b-a)*n
        if odd==1:
            sum=sum+1
        print(sum)
    #a,b=
    #mapでとってもstrで変換すればappend可能
    #s=input()
    #a=[i for i in s]#int(i)にすれば数字も行ける
    #nl=list(map(int, input().split(" ")))#数字の時
    #print(a)
    #brray=[list(map(int, input().split(" ")))for i in range(N)]
    #print(brray)


    #for i in range(1,n+1,2):#これで1個飛ばしループになる
    # pass
     #print(i)

    l = ['aaa', 'bbb', 'ccc']
    x=l.index('aaa')#ある要素のインデックス番号を取得
    #s = ''.join(l)
    #s = " ".join(map(str,a))#スペースを空ける時はこう
    #print(s)
    # aaabbbccc

    #if state in known_states and not flag: # state => 2 steps => 5
        #こうやってある要素がリストの中にあるか探すのか
    #print(f'steps: {steps}, state: {state}')
    #こう書いてあるとデバックしやすい

    #dp= [[0]*3 for i in range(5)]#列　行
    #dp用の0の入ったやつ
    #dp= [[0]*(w+1) for i in range(n+1)]#0からwまでのw+1回計算するから
    #print(dp)＃初期条件が入る分計算回数+1列分必要(この場合は判断すべきものの数)
    DP = np.zeros(w+1, dtype=int)#これでも一次元リストが作れる
    exdp=np.zeros((3,4)) # ３×４の２次元配列を生成。2次元ならこう
    #dtypeは指定しないとfloatになる
    #for i in range(n):#ちょっとした入力に便利
    #    a, b = map(int, input().split())
        #dp[i][0] += [a]
        #これだとintとlistをつなぐことになって不適
    #    dp[i] += [a]
    #    dp[i] += [b]
        #これはうまくいく
        #やり方はいろいろあるということ
    #print(dp)


    #brray=[list(map(int, input().split(" ")))for i in range(N)
    #print(brray)



    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]#内包表記に慣れろ
    #print(pin_l)

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


    #print(ls[2:5])
    #スライスでの取得

    #print(ls[:-3])
    #一番左端から右から3番目より左まで取得

    #print(ls[:4:2])
    #スライスで1個飛ばしで取得
    #ないときは左端スタート
    #始点のインデックス番号 : 終点のインデックス番号 : スキップする数+1
    #print(ls[::2])
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#%% for atcoder uniittest use
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))
#%%code
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)

#%%submit!
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

# ループに入るまでの操作
count = A
K -= (A - 1)
# これ以降はAを交換してBを繰り返す。２回ごとにBーA増えていく

count += (K // 2) * (B - A)
# B変換できない分のあまりは叩いて増やしておく
count += K % 2
print(count)

Submission status: Accepted

Solution code:
k,a,b = map(int,input().split())
ans0 = 1+k
#a<bの時のみ交換を行う。1>>aになるまで加算し、そのあとはa-bを繰り返す。

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

Submission status: Accepted

Solution code:
k,a,b = map(int,input().split())
if a+2>=b:
  print(1+k)
else:
  #bisできるセット
  q = (k-a+1)//2
  if q ==0:
    print(1+k)
  else:
    print(1+(k-2*q)+q*(b-a))

Submission status: Accepted

Solution code:
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
    #    print(c)
        if K%2:
            K-=1
            c+=1
        c+=K//2*(B-A)
        print(c)
else:
    print(1+K)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import re
import math
import collections
import decimal
import bisect
import itertools

import copy

# import heapq
# from collections import deque
# import decimal

# sys.setrecursionlimit(100001)
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()))


# ===CODE===


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

t = k
cnt = 1

#ビスケットと1円を交換したほうがいい時
if a+1<b:
    #1回1円と交換できるようになるまでビスケットを増やす
    cnt += a-1
    t -= a-1
    #print(cnt)
    #print(t)
    #ビスケットと1円を交換→1円とビスケットを交換を限界まで繰り返す
    cnt += b*math.floor(t/2)
    cnt -= a*math.floor(t/2)
    t -= 2 * math.floor(t/2)
    #print(cnt)
    #print(t)
    #ビスケットをたたいて増やす
    cnt += t
else:
    cnt +=k
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Problem C - When I hit my pocket...

import math

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

# initialization
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)

# calc
ans = max(koho_1, koho_2)

# output
print(ans)

Submission status: Accepted

Solution code:
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))
    # print(max(0, math.ceil((k - a + 1)/2)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def myAnswer(K:int,A:int,B:int) -> int:
   if(K <= A-1): return K+1
   tmp =(K - (A-1))
   # print(tmp)
   ans = (B - A) * math.floor(tmp//2) + tmp % 2 + A
   # print(ans)
   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()

Submission status: Accepted

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