Mike and the Warehouse

5

3 votes
Medium
Problem

Mike Ehrmantraut, the most badass assassin & investigator of all times. He works under Gus Fring for Los Pollos Hermanos as the head of corporate security.

As we all know, Gus runs an operation of the illegal trade of the drug called crystal meth. For one of his meetings, he calls in Mike to go to the dealers for obtaining a contract from Russia.

They give him a location of a mysterious warehouse on a deserted place. He agrees and goes to the warehouse in which only two people (dealers) are present. Let us represent the place in the form of 2-D Plane.

Both people, i.e. dealers of the opposite party are standing on the co-ordinate position (X,Y). Similarly, Mike is standing on position (P,Q) They call Mike on the phone and tell him not to move any further until they order him to do so.

As mentioned earlier, the warehouse is a bit mysterious. They tell him on the phone, that there are bombs on the warehouse which is controlled by them. The warehouse is equipped with security cameras all over the place. They give him a task & instruct him to reach over to their position.

You can move one unit at a time in the four possible directions parallel to the coordinate axis & cannot move consecutive steps in the same direction.

Mike needs to do this using minimum number of steps. If he breaks any rule, the dealers will blow the bombs! Can you help Mike?

INPUT

  • First line contains an integer T, the number of Test Cases.
  • Each test case consists of 2 lines. First line contain two space separated integers X and Y. Second line contain two space separated integers P and Q.

OUTPUT

  • Output the answer of each test case in a separate line.

CONSTRAINTS

  • 1 ≤ T ≤ 106
  • -106 ≤ X,Y,P,Q ≤ 106

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?