eolymp
bolt
Try our new interface for solving problems

Game

John and George play the following game: John chooses one integer x in the set An = {1, 2, 3, ..., n} . George has to guess the value of x. Players play by consecutive moves = 1, 2, ... . In the k-th move of the game, George chooses a subset Bk of An and John says YES, if x belongs to Bk or NO, otherwise. In case of answer NO, George pays John a euros; in case of answer YES, George pays John b euros. We want to know the minimum amount of euros that George has to pay in order to find x, regardless of John's choice.

Write a program that calculates the wanted minimum amount.

Input

In one line given three integers n (1 < n < 1018), a and b (0 < a, b < 1000).

Output

Print out one integer, that is equal to the wanted minimum amount of euros.

Explanation

George can find x for 4 euros, in the following way:

George selects set B1 = {1, 2}.

  • If John's answer is YES, George pays 2 euros and then selects set B2 = {1}. If the next answer is YES, George pays another 2 euros and the game ends (the chosen integer was 1), otherwise he pays another 1 euro and the game ends (the chosen integer was 2).

  • If John’s answer is NO, George pays 1 euro and selects the set B2 = {3}. If the next answer is YES, George pays another 2 euros and the game ends (the chosen integer was 3), otherwise he pays another 1 euro and selects the set B3 = {4}. If the last answer is YES, George pays another 2 euros and the game ends (the chosen integer was 4), otherwise George pays another 1 euro and the game ends (the chosen integer was 5).

Time limit 1 second
Memory limit 128 MiB
Input example #1
5 1 2
Output example #1
4
Source 2015 VII International autumn tournament in informatics, Shumen, Senior, Problem B