I found an interesting problem on https://www.codechef.com/SCAT2020/problems/SC_04:
-----Problem Statement-----
Harry Potter has one biscuit and zero rupee 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$ rupee.
- Exchange $1$ rupee to $B$ biscuits.
Find the maximum possible number of biscuits in Harry's pocket after $K$ operations.

-----Input-----
Input is given in the following format:
K A B

-----Output-----
Print the maximum possible number of biscuits in Harry's pocket after $K$operations.

-----Constraints-----
- $1 \leq K, A, B \leq 10^9$
- $K$, $A$ and  are integers.

-----Sample Input-----
4 2 6

-----Sample Output-----
7

-----EXPLANATION-----
The number of biscuits in Harry's pocket after $K$ operations is maximized as follows:
- Hit his pocket. Now he has $2$ biscuits and $0$ rupee.
- Exchange $2$ biscuits to $1$ rupee in his pocket .Now he has $0$ biscuits and $1$ rupee.
- Hit his pocket. Now he has $1$ biscuits and $1$ rupee.
- Exchange $1$ rupee to $6$ biscuits. his pocket. Now he has $7$ biscuits and $0$ rupee.

I tried it in Python, but could not do it. Can you solve it?
import sys
# sys.stdin = open('input.txt', 'r') 
# sys.stdout = open('output.txt', 'w')
 
import math
import collections
from sys import stdin,stdout,setrecursionlimit
import bisect as bs
setrecursionlimit(2**20)
M = 10**9+7

# T = int(stdin.readline())
T = 1

for _ in range(T):
    # n = int(stdin.readline())
    n,a,b = list(map(int,stdin.readline().split()))
    # h = list(map(int,stdin.readline().split()))
    # q = int(stdin.readline())
    # a = list(map(int,stdin.readline().split()))
    # b = list(map(int,stdin.readline().split()))
    if(a>(n-1)):
        print(n+1)
        continue
    if(b-a-2>0):
        ans = a
        op = n-(a-1)
        ans += (op//2)*(b-a)
        ans += (op%2)
        print(ans)
        continue
    print(n+1)