I I U P C 2 0 0 6

Problem I: IIUC HexWorld

Input: standard input

Output: standard output

 

Alice and Bob reside in Independent Impeccable United Countries (IIUC) – a land of the free. There, all the houses are placed in a hexagonal grid. The king’s palace is numbered 0 and all others are numbered 1, 2, 3 ... spirally keeping the king’s palace at the center. There is a single street, starting at king’s palace and built like a spiral, touching the houses 1, 2, 3 ... sequentially. The following picture shows the first few houses and the street in heavy dark line.

 

 

Alice lives in house A and Bob lived in house B. When Alice wants to visit Bob, since she is afraid of the dark, she sticks to the road. When Bob wants to visit Alice, he walks straight to Alice’s home.

 

Input

On each line, there will be a pair of integers, A and B.

 

Output

For each line of input, print the distance covered by Alice and Bob respectively, with three digits after decimal point.

 

Constraints

-           0 ≤ A, B ≤ 107

 

Sample Input

Output for Sample Input

1 2
1 3
1 4
1 7
1 8
1 9

1.000 1.000
2.000 1.732
3.000 2.000
6.000 1.000
7.000 1.000
8.000 1.000

 

Problemsetter: Mushfiqur Rouf