#P252. 【例42.1】 雇佣兵
【例42.1】 雇佣兵
Description
A mercenary has a maximum stamina of M, initial stamina of 0, combat power of N, and X energy elements.
When the mercenary's stamina is exactly M, they can participate in a battle period lasting M days, after which their stamina will be 0. During the same battle period, for every n consecutive days of fighting, the mercenary's combat power increases by 1 point, where n is the combat power at the start of the current battle period.
After a battle period ends, the mercenary needs to use several energy elements to restore their stamina to the maximum value M to participate in the next battle period. Each energy element can restore some stamina, but the amount restored by each energy element cannot exceed the current combat power. Each energy element can only be used once.
What is the maximum combat power the mercenary can reach?
Note: Energy elements can only be used after a battle period ends, and multiple energy elements can be used.
Input Format
A single line containing three integers M, N, and X, separated by spaces. M, N, and X are positive integers not exceeding 10000.
Output Format
Output a single integer representing the mercenary's maximum combat power.
Sample
5 2 106