A. Barcelona Distance
time limit per test
5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

In previous meetings of the Independent Organization of Epizootics, also known as the World Organization for Animal Health, everyone gathered in Barcelona to discuss the most relevant topics. However, every year they faced several problems.

Many members do not know the distance from the meeting place to the hotel, so when they want to take a taxi, they do not know how much money to bring. It is clear that they will not bring more than necessary as they fear losing money. For this and other reasons, this year the meeting will be held remotely.

Specifically, we will assume that Barcelona is an infinite grid with the origin at $$$(0,0)$$$, with blocks measuring 10 meters on each side and with an infinite diagonal that crosses the city passing through $$$(0,0)$$$ and $$$(10,10)$$$. Since taxi drivers want to minimize travel time, the taximeter does not count the distance traveled on the Diagonal. For simplicity, we will assume that all streets are bidirectional. Therefore, the distance in Barcelona is the minimum distance between two points traveling along the streets of Barcelona.

To facilitate future meetings, the organization asks you to help them calculate the distance in Barcelona from the meeting place to various hotels.

Input

The input consists of several cases.

The first line of each case contains 2 integers $$$x_r, y_r$$$, the coordinates of the meeting place, followed by $$$Q$$$ integers, the number of hotels to consider. The next line consists of $$$Q$$$ pairs of integers $$$x_i, y_i$$$, the coordinates of the i-th hotel, separated by spaces.

It is guaranteed that:

- All points are on a street, meaning one of the two coordinates is a multiple of ten.

Output

For each case, you must print $$$Q$$$ non-negative integers separated by a newline at the end.

The i-th non-negative integer is the distance in Barcelona between the i-th hotel and the meeting place.

Scoring

$$$ 1 \leq x_i, y_i, x_r, y_r \leq 10^7 \ \forall i$$$

$$$ 1 \leq Q \leq 10^4 $$$

Subcases

Subcase 1 (10 pt):

- All coordinates are multiples of 10.

- $$$0 \leq x_i, x_r \leq 10^3$$$

- $$$10^6 \leq y_i, y_r \leq 10^6 + 10^3$$$

Subcase 2 (20 pt):

- All coordinates are multiples of 10.

- $$$0 \leq x_i, x_r \leq 10^4$$$

- $$$10^6 \leq y_i, y_r \leq 10^6 + 10^4$$$

Subcase 3 (30 pt):

- All points are multiples of 10.

Subcase 4 (40 pt):

- No additional restrictions.

Examples
Input
0 1000000 2
0 1000010 10 1000010
0 1000020 2
0 1000010 10 1000010
Output
10 20
10 20
Input
0 1000000 2
0 1010000 9090 1010000
Output
10000 19090
Input
0 0 2
10 10 20 10
Output
0 10
Input
0 5 2
10 15 6 10
Output
10 9