Take any four positive integers: , , , . Form four more, like this:
|a-b| |b-c| |c-d| |d-a|
That is, take the absolute value of the differences of with , with , with , and with . (Note that a zero could crop up, but they'll all still be non-negative.) Then, do it again with these four new numbers. And then again. And again. Eventually, all four integers will be the same. For example, start with , , , :
1 3 5 9
2 2 4 8 ()
0 2 4 6 ()
2 2 2 6 ()
0 0 4 4 ()
0 4 0 4 ()
4 4 4 4 ()
In this case, the sequence converged in steps. It turns out that in all cases, the sequence converges very quickly. In fact, it can be shown that if all four integers are less than 2^n, then it will take no more than 3 \cdot n steps to converge!
Given , , and , figure out just how quickly the sequence converges.
There will be several test cases in the input. Each test case consists of four positive integers on a single line (1 \le a, b, c, d \le 2{,}000{,}000{,}000), with single spaces for separation. The input will end with a line with four s.
For each test case, output a single integer on its own line, indicating the number of steps until convergence. Output no extra spaces, and do not separate answers with blank lines.
Example 1