Smarter than hunger

In the laboratory we are performing a series of experiments to study the intelligence of a species of mice. In the experiments we placed mice in a rectangular box divided into cells like the one in the figure. The mice are placed in the lower left corner and must find the exit located in the upper right corner. They can move freely through all the cells, but from each cell they can only move to the adjacent horizontal or vertical. For these mice that is very easy, so we have been complicating the experiment. First we put a series of buttons (red circles in the figure) in some cells so that the mice had to press all those buttons to open the exit door. Soon they learned how to do it, and in addition in the fastest possible way. To boost teamwork, we have now numbered the buttons from 1 to N. In order for the i button to be useful for opening the door, the buttons with a smaller number must have been pressed first. In the experiment two mice are placed in the initial cell and both must collaborate pressing the buttons in order to get out of the labyrinth in the shortest possible time. There are no more restrictions on which buttons each mouse presses, except that if a mouse pressed the i button, before that he or his partner must have pressed the i–1 button. If they do, they will find a succulent cheese at the exit. If not, they will only have hard bread. We are much less clever than these mice and we do not know if they are doing it in the best time. Can you help us calculate it assuming that a mouse always takes 1 second to move from one cell to an adjacent one? The time it takes for a mouse to press a button is negligible, so in the same second a mouse could press the i button and the other the button i + 1. Note that the presence of a button in a cell does not prevent a mouse from passing through it without pressing it. Input The input is composed of a series of test cases. For each case, the first line contains the number R of rows and the number C of columns of the cell structure contained in the box (both numbers are between 1 and 50). The next line contains the number N of buttons (between 0 and 100) to be pressed. The following N lines give the positions of these buttons (a row between 1 and R and a column between 1 and C) in the order in which they have to be pressed. Output For each case, the minimum time needed for the two mice initially located in the cell (1, 1) to leave the box having pressed all the buttons, will be written. Once the cell (R,C) is reached, if the exit door is open, the mice can exit with 1 more second.

2/2 Sample Input 46 3 24 26 42 33 4 21 12 31 13 Sample Output 11 5