#C10231. Calculate Manhattan Distance on a Grid

    ID: 39414 Type: Default 1000ms 256MiB

Calculate Manhattan Distance on a Grid

Calculate Manhattan Distance on a Grid

Given two points on a two-dimensional grid, your task is to compute the Manhattan distance between them. The Manhattan distance between two points \( (x_1, y_1) \) and \( (x_2, y_2) \) is defined as \( |x_1 - x_2| + |y_1 - y_2| \).

The input starts with an integer indicating the number of test cases. Each subsequent line contains four integers representing the coordinates of two points. For each test case, you should output the computed Manhattan distance on a new line.

inputFormat

The input is provided via standard input (stdin). The first line contains an integer \( T \) representing the number of test cases. Each of the following \( T \) lines contains four space-separated integers \( x_1 \), \( y_1 \), \( x_2 \), and \( y_2 \) which describe the coordinates of the two points.

outputFormat

For each test case, output the Manhattan distance, calculated using the formula \( |x_1 - x_2| + |y_1 - y_2| \). The output should be printed to standard output (stdout) with each result on a new line.

## sample
3
0 0 1 1
-1 -1 1 1
2 3 2 3
2

4 0

</p>