House Construction

No attempts yetTime limit1sMemory limit128 MB

Problem

A construction company has been ordered to build $L$ identical houses. Building one house consumes $X$ wooden planks and occupies exactly one unit of area. A plot of exactly $L$ units of area has been allocated for the project, so the finished houses will fill the plot completely.

The company already owns 10 plank factories, which stand on separate land and are always in operation. Building one additional factory consumes $Y$ wooden planks and occupies one unit of area. No extra land is available for factories, so any additional factory must be built on the project plot itself and later torn down to free space for houses.

Every operating factory produces exactly 10 planks per day, and all planks are identical. Any plank not used on the day it is produced is destroyed overnight, so planks cannot be stored, and planks from a demolished factory cannot be reused.

On a single day the workers may perform exactly one of the following actions:

  • Build any number of factories, as long as the factories operating that day produce enough planks ($Y$ per new factory) and enough free area is available (one unit per new factory).
  • Build any number of houses, as long as the factories operating that day produce enough planks ($X$ per new house) and enough free area is available (one unit per new house).
  • Tear down any number of factories.

A newly built factory begins producing planks on the day after it is built. The original 10 factories are always operating.

Determine the minimum number of days needed to complete the order, that is, to build all $L$ houses.

Input

The input consists of three lines. The first line contains a positive integer $L$ ($L \le 2500$), the number of houses to build. The second line contains a positive integer $X$ ($X \le 255$), the number of planks needed to build one house. The third line contains a positive integer $Y$ ($Y \le 255$), the number of planks needed to build one factory.

Output

Print a single integer: the minimum number of days in which the order can be completed. If the order cannot be completed with the given values, print 0.

Hint

For $L = 50$, $X = 30$, $Y = 10$ the order can be completed in 12 days. Writing each state as [houses built, operating factories, free area]:

  • Start: [0, 10, 50]
  • Day 1: build 10 factories -> [0, 20, 40]
  • Day 2: build 10 factories -> [0, 30, 30]
  • Day 3: build 10 houses -> [10, 30, 20]
  • Day 4: build 10 houses -> [20, 30, 10]
  • Day 5: build 10 houses -> [30, 30, 0]
  • Day 6: tear down 15 factories -> [30, 15, 15]
  • Day 7: build 5 houses -> [35, 15, 10]
  • Day 8: build 5 houses -> [40, 15, 5]
  • Day 9: build 5 houses -> [45, 15, 0]
  • Day 10: tear down 5 factories -> [45, 10, 5]
  • Day 11: build 3 houses -> [48, 10, 2]
  • Day 12: build 2 houses -> [50, 10, 0]