Delta-wave  

On the triangular field shown on the picture, small triangles are numbered from 1 to oo (infinity). Traveller wants to go from triangle M to triangle N. Traveller can move only through the sides of triangles, not vertices. The number of sides he crosses is called the path length.
You are to determine the shortest path from M to N.

The Input

Input contains integers M and N (1<=M,N<=1000000000), separated by some spaces.

The Output

Your programm should print the length of the shortest path from M to N.

Sample Input

6 12

Sample Output

3

Alex Gevak
September 10, 2000 (Revised 2-10-00, Antonio Sanchez)