Two Vessels
You have two empty vessels with capacities of V_1 and V_2 liters, along with a large barrel filled with water. Your task is to create a program that calculates the minimum number of water transfers required to measure exactly V_3 liters in one of the vessels. The constraints are as follows: 0 < V_3 < V_1 < 1000 and 0 < V_3 < V_2 < 1000. A transfer can either be filling a vessel from the barrel or pouring water from one vessel to the other.
Input
The input file's first line contains three integers. The first two integers represent the capacities of the first (V_1) and second (V_2) vessels, while the third integer represents the target volume V_3.
Output
The output should be a single integer, which is the minimum number of water transfers needed to achieve exactly V_3 liters in one of the vessels.