AT_past20_n パワーアップ
Description
There is a $ 10^9 \times 10^9 $ grid. Let $ (i, j) $ denote the cell in the $ i $ -th row from the top and $ j $ -th column from the left.
The hero is initially at $ (1, 1) $ . He can move to one of the four adjacent cells: up, down, left, or right. Once he reaches cell $ (A, B) $ , the hero powers up, after which he can move to one of the eight adjacent cells.
- The eight cells adjacent to $ (i, j) $ are $ (i-1, j-1), (i-1, j), (i-1, j+1), (i,j-1), (i,j+1), (i+1,j-1), (i+1,j), (i+1,j+1) $ (except for non-existent ones).
Besides, there are $ N $ coins. Coin $ i $ is at cell $ (C_i, D_i) $ . He can collect the coin when he reaches the cell.
He wants to collect all the coins. At least how many moves are required to collect them?
Input Format
The input is given from Standard Input in the following format:
> $ N $ $ A $ $ B $ $ C_1 $ $ D_1 $ $ C_2 $ $ D_2 $ $ \vdots $ $ C_N $ $ D_N $
Output Format
Print the answer.
Explanation/Hint
### Sample Explanation 1
The hero can make the following $ 11 $ moves to collect all the coins.
- The hero is initially at $ (1, 1) $ .
- He makes three moves to collect the coin at $ (4, 1) $ .
- He makes two moves to reach $ (5, 2) $ and power up.
- He makes one move to collect the coin at $ (6, 3) $ .
- He makes five moves to collect the coin at $ (1, 7) $ .
Since he cannot collect all the coins with $ 10 $ moves or less, the answer is $ 11 $ .
### Constraints
- $ 1 \leq N \leq 16 $
- $ 1 \leq A, B, C_i, D_i \leq 10^9 $
- $ (1, 1), (A, B), (C_1, D_1), \dots, (C_N, D_N) $ are pairwise distinct.
- All input values are integers.