﻿ Ningbo University of Technology Online Judge :: [1116] Flandre's Passageway
• ### [1116] Flandre's Passageway

• 时间限制: 1000 ms　内存限制: 65535 K
• 问题描述
• Flandre Scarlet(フランドール·スカーレット) is a vampire of The Embodiment of Scarlet Devil. But she is unfortunate because she is always in the undercroft.
The undercroft has so many rooms signed as room[1][1], room[1][2], ... room[N][M].
Today she wants to go from the room[1][1] to room[N][M]. Every room she can only go straight along the walls but some special rooms.
In the special rooms, she Flandre can go through it.
You can imagine that the length of every wall is 100.
Can you help Flandre to caculate out the minimum length she would go from the room[1][1] to room[N][M]?
You can reference the picture below.

• 输入
• This problem has several cases.
The first line of each case contains 2 integers N and M (0 < N, M <= 100000).
Then follow a line that only contains an integer K (0 < K <= 2000), indicates the number of special rooms.
The next K lines stands for the coordinate X, Y(1 <= X <= N, 1 <= Y <= M) of each special room.
• 输出
• For each case, you only need to print the minimum length that Flandre would go from (1, 1) to (N, M). Round to the nearest integer.
• 样例输入
• ```3 2
3
1 1
3 2
1 2
```
• 样例输出
• ```383
```
• 提示
• `无`
• 来源
• `XadillaX`
• 操作
﻿