Brick Walls

You have to lead a pack of ants in search of food. The ants have to march through a rather large brick wall. They need to ensure that they are not on the surface of the bricks as it gets easier for mean people to crush them. If they can travel through the valleys, it would be much harder to kill them. The bricks are laid out in a regular grid like pattern (as shown in the figure). Each brick is a rectangle that is 2 units long horizontally and 1 unit long vertically. There are tiny gaps (val- leys) in between two bricks (both horizontally and vertically). The ants are to start at a point in the valley, and their destination is a point in the valley as well. As the bricks are of fixed size and are following a regular pattern with gaps, these points can always be represented by integer coordinates. Your task is to find the distance of the shortest path from the starting point to the destination point. Input There can be at most 1000 test cases. Each test case consists of four integers giving the values of starting row Sr, starting column Sc , destination row Dr, destination column Dc. You can assume that 1 ≤ Sr,Sc,Dr,Dc ≤ 10 9. The last line of input will be ‘0 0 0 0’ — this line must not be processed as a test case. Output For each test case print the distance of the shortest path in a single line. Sample Input 17 27 5 43 2 2 33 6 0 00 0 Sample Output 1 4 4