Odesa is a very famous city, often called Odesa-mama, for it has become a welcoming home for people of many nationalities. Most importantly, everyone here lives peacefully and in harmony, despite having different cultures, views, and languages. That's why Odesa is home to restaurants representing the cuisines of numerous cultures from around the world.
Tourists naturally love to eat. But what's more interesting is to taste Georgian cuisine, French, Italian, and more... For this, you need to move between restaurants, which takes precious time. As a resourceful programmer, you want to optimize the process of moving between restaurants. You have managed to obtain a map of Odesa's restaurants, and now you have everything you need.
The nationalities are numbered from to . On the map, each restaurant is labeled with the nationality number it represents. You decided to visit the various cuisines in order of their numbering (, , , ...), visiting the cuisine of each nationality exactly once. You may start at any restaurant of the first cuisine and finish at any restaurant of the -th cuisine. Your task is to find the path of minimal length that lets you visit the cuisines in order as described.
In Odesa, the streets are strictly perpendicular (or so the tour guides say :)), so we will model the map as a rectangle of N \times M, divided into unit squares. Movement is allowed between adjacent squares that share a side. The distance between two cells with coordinates (x_1, y_1) and (x_2, y_2) is |x_2-x_1| + |y_2-y_1| (the Manhattan distance). Note that you may pass through a cell containing a restaurant without stopping there.
The first line contains the integers , , (1 \le N, M \le 100, 1 \le K \le N \times M).
The following lines each contain numbers: the nationality number (from to ) of the restaurant in that unit square, or if there is no restaurant there. It is guaranteed that restaurants of all nationalities are present on the map.
Output a single integer: the length of the shortest possible path.
Example 1