Paint Mix

No attempts yetTime limit1sMemory limit128 MB

Problem

You are given two large pails. One of them (the black pail) contains $B$ gallons of black paint. The other (the white pail) contains $W$ gallons of white paint. You perform a number of iterations of pouring paint. In each iteration you first pour $C$ cups of paint from the black pail into the white pail (and thoroughly mix the white pail), then pour $C$ cups of paint from the white pail back into the black pail (and thoroughly mix the black pail). $B$, $W$, and $C$ are positive integers; each of $B$ and $W$ is at most $50$, and $C < 16 \cdot B$ (recall that 1 gallon equals 16 cups). The white pail's capacity is at least $B+W$.

As you perform many successive iterations, the ratio of black paint to white paint in each pail approaches $B/W$. Although these ratios never become exactly $B/W$, one can ask: how many iterations are needed so that the black-to-white paint ratio in each of the two pails differs from $B/W$ by less than a given tolerance. The tolerance is defined to be $0.00001$.

Input

The input consists of several lines. Each line contains the input for one instance of the problem: three positive integers giving the values of $B$, $W$, and $C$ as described above. The input is terminated by a line where $B = W = C = 0$, which is not processed.

Output

Print one line of output for each instance. Each line contains a single positive integer: the smallest number of iterations required so that the black-to-white paint ratio in each of the two pails differs from $B/W$ by less than the tolerance.