cho.sh
Notes
Loading...

Flipping

Time limit

2s

Memory limit

128 MB

Problem

Hongjun has A zeroes and B ones. The goal is to make every number equal to 1.

In one turn, he chooses exactly K numbers and flips their values. A 0 becomes 1, and a 1 becomes 0. On every turn, he may choose any K numbers among the A+B numbers, regardless of their current values or whether they were chosen before.

Find the minimum number of turns needed to reach the goal. If it is impossible, output -1.

Input

The first line contains three integers A, B, and K.

Output

Print the minimum number of required turns on the first line. If it is impossible to make every number equal to 1, print -1.

Constraints

  • 0 ≤ A, B ≤ 100,000
  • 1 ≤ K ≤ 100,000