cho.sh
Notes
Loading...

Barracks

Time limit

2s

Memory limit

128 MB

Problem

Jungyeom is playing a turn-based strategy game. His goal is to destroy the opponent's barracks and remove every opponent marine.

At first, Jungyeom has N marines, and the opponent has no marines. The opponent's barracks has B health. As long as the barracks has not been destroyed, it produces U marines at the end of each turn.

Each turn proceeds in this order.

  1. Each of Jungyeom's surviving marines chooses either to attack one opponent marine and remove it, or to attack the barracks and reduce its health by 1. Different marines may make different choices. If the barracks health becomes 0 or less, it is destroyed immediately.
  2. All opponent marines that were not removed attack Jungyeom's marines. If K opponent marines remain, K of Jungyeom's marines are removed.
  3. If the barracks has not been destroyed, U opponent marines are produced.

Find the minimum number of turns required for Jungyeom to destroy the barracks and remove all opponent marines.

Input

The first line contains three integers N, B, and U.

Output

Print the minimum number of turns needed to destroy the opponent's barracks and remove all opponent marines. If it is impossible, print -1.

Constraints

  • 1 <= N, B, U <= 5,000