

A rack in a police department consists of shelves
that are organised in C columns and R rows.
To reach an object from any shelf, a ladder must be used. A ladder can be leaned
against one column of shelves only. By climbing the ladder to a certain height
(row) it is possible to take any object from that column up to climbed height
including any object from adjacent (left and right) columns.
Policemen need to take certain objects from the rack. To lower a risk of injury
at work, it is necessary to find a way to take all needed objects from the rack
so that total height of all climbing is minimal possible. Total height is a
sum of heights of all climbings.
A rack with some object lying on its shelves is given.
Write a program that will determine minimal possible total height of climbings
needed to collect all the objects from the rack.
Input data
The first line of input file contains two integers
C and R, 1 <=C <=100, 1 <=R <=100, number of columns and number
of rows, separated by a space character.
The second line of input file contains an integer N, 1 <=N <=100, number
of shelves that needs to be reached.
Every of next N lines contains two integers A and B, 1 <=A <=C, 1 <=B
<=R, separated by a space character, number of column and a row of a shelf
that need to be reached.
Output data
The first and only line of output file should contain minimal possible total height of climbings needed to reach all given shelves.
Examples
SHELVES.IN
5 5
3
2 3
3 4
4 4
SHELVES.OUT
4
SHELVES.IN
6 20
4
5 6
1 1
6 1
3 7
SHELVES.OUT
9
SHELVES.IN
10 10
5
9 1
7 6
5 8
4 1
3 2
SHELVES.OUT
11