#P9863. [POI 2021/2022 R2] arm

[POI 2021/2022 R2] arm

Background

Translated from POI2021-2022R2 Day0 Warm-up Problem.

Problem Description

Initially, you have 11 item. You need to increase the number of items to >n> n by performing the following step multiple times.

  • Option 11: Store the current number of items into the database, costing aa time.
  • Option 22: Increase the number of items by an amount equal to the number stored in the database, costing bb time.

Initially, the database is empty. Find the minimum number of operations.

Input Format

Input one line with three integers $n,a,b\ (1 \leq n \leq 10^{18},1 \leq a,b \leq 10^9)$.

Output Format

Output the minimum number of operations.

8 2 1
8

Hint

Explanation of the sample:

Initially, you have one item.
First, perform one scan, costing 22 time.
Then print 22 times, costing 1×2=21 \times 2 = 2 time, and the number increases to 33.
Continue with another scan, costing 22 time.
Finally, print 22 more times, costing 1×2=21 \times 2 = 2 time, and the number becomes 99.

Subtask distribution:

Subtask ID Special Property Points
11 a=b=1a = b = 1 1010
22 n103n \leq 10^3 4040
33 n105n \leq 10^5 1515
44 n109n \leq 10^9
55 No special constraints 2020

Subtask 00 is the sample.

Translated by ChatGPT 5