Question
Value Vault
Mira starts with an integer B = 1 and is given integers M and L. In one move, she can either double B or add L to B. Find the smallest possible value of B after exactly M moves.
Input
The first line of the input contains two integer M and L.
Output
Print the minimum possible value of B after exactly M operations.
Example
Sample Input
4 3
Sample Output
10
Explanation
We perform the moves like this:
1 -> 2 (double)
2 -> 4 (double)
4 -> 7 (add)
7 -> 10 (add)
4 3
Sample Output
10
Explanation
We perform the moves like this:
1 -> 2 (double)
2 -> 4 (double)
4 -> 7 (add)
7 -> 10 (add)