QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 256 MB 満点: 100

#2659. Clone Army

統計

Bajtazar, a general of the Byteotian Republic army, is facing another challenge. According to intelligence reports, the Republic is soon to be attacked by the forces of the hostile Bitotian Federation. The situation seems dramatic, as the Federation's powerful army consists of $n$ combat robots, while the Republic has only one robot. Fortunately, Bajtazar has recently purchased a very efficient and precise 3D printer. The machine can scan and store the entire Byteotian army in its built-in memory (this operation always takes $a$ hours, regardless of the army size). It can also print the contents of the built-in memory, which always takes $b$ hours. After one scanning operation, multiple printing operations can be performed.

Bajtazar is now wondering how much time he needs so that the size of his army (including the original robot) exceeds the size of the Bitotian Federation's army. Help him with this task.

Input

The first and only line of input contains three integers: $n$, $a$, and $b$ ($1 \le n \le 10^{18}$, $1 \le a, b \le 10^9$), representing the size of the Federation's army and the parameters of Bajtazar's printer.

Output

The first and only line of output should contain a single integer $t$ representing the minimum number of hours needed to print at least $n$ new robots.

Examples

Input 1

8 2 1

Output 1

8

Note

It takes at least 8 hours to obtain a total of at least 9 robots. Initially, you must scan the robot, which takes 2 hours. Then, you must print the contents of the memory twice, which takes another 2 hours and increases the army size to 3 robots. Then, you must scan the entire army again and print the contents of the memory twice, which takes a total of 4 hours and increases the army size to 9. In this way, after 8 hours, 8 new robots are created, and at the end, a scan of 3 robots is in the printer's memory.

Subtasks

The test set is divided into the following subtasks. Tests for each subtask consist of one or more separate test groups.

Subtask Conditions Points
1 $a = b = 1$ 10
2 $n \le 1000$ 40
3 $n \le 100\,000$ 15
4 $n \le 10^9$ 15
5 no additional conditions 20

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.