cho.sh
Notes
Loading...

Bicycle Race

Time limit

2s

Memory limit

512 MB

Problem

A cycling team has N (1 <= N <= 20) riders. The team wants a strategy that reaches the finish line in the earliest possible integer number of minutes.

The riders can ride together instead of riding alone. During any one-minute interval, if the team rides at x laps per minute, where x is a positive integer, the front rider spends x*x energy during that minute, while every other rider still riding with the group spends x energy. The front rider may be changed at the end of each minute, and changing the front rider costs no time or energy. A rider may quit during the race; after quitting, that rider no longer rides.

The race is D (1 <= D <= 100) laps long. Every rider starts with E (1 <= E <= 100) energy. It is enough for one rider to cross the finish line.

Find the earliest integer time in which the race can be completed. If the group passes D laps partway through a one-minute interval, it still must have enough energy to finish that whole interval, and the completion time is rounded up to the next integer minute.

Input

The first line contains three integers N, E, and D.

Output

Print the earliest integer time in which the team can finish the race. If there is no possible strategy because the riders do not have enough energy, print 0.