#K12321. Shortest Delivery Route

    ID: 23665 Type: Default 1000ms 256MiB

Shortest Delivery Route

Shortest Delivery Route

You are given the coordinates of a warehouse and a set of delivery addresses. Your task is to determine the minimum total Manhattan distance required to start at the warehouse, visit each address exactly once, and return to the warehouse.

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| ]

You need to consider all possible orders of visiting the addresses and choose the order that minimizes the total distance.

Note: Because the number of addresses can be small, a brute-force approach using permutation of addresses is acceptable.

inputFormat

The first line contains a single integer \(n\) indicating the number of delivery addresses.

The second line contains two space-separated integers representing the \(x\) and \(y\) coordinates of the warehouse.

The following \(n\) lines each contain two space-separated integers representing the \(x\) and \(y\) coordinates of a delivery address.

outputFormat

Output a single integer, which is the minimum total Manhattan distance to start at the warehouse, visit each address exactly once, and return to the warehouse.

## sample
3
0 0
1 1
2 2
3 3
12

</p>