Two Vessels#2690

Two Vessels

1 second
64 megabytes
Easy

You are given two empty vessels with capacities V_1 and V_2 liters, as well as a large barrel filled with water. The goal is, using only these two vessels, to obtain exactly V_3 liters in one of them using the minimum number of pouring operations. A pouring operation is either filling a vessel from the barrel or pouring water from one vessel to the other.

Constraints:

0 < V_3 < V_1 < 1000 \\ 0 < V_3 < V_2 < 1000

Input

The input contains a single line with three integers: the capacities of the first (V_1) and second (V_2) vessels, and the required volume V_3.

Output

Output a single integer — the minimum number of pouring operations required to obtain exactly V_3 liters in one of the vessels.

Examples

Example 1

Loading
Loading