import std.stdio, std.string, std.range, std.conv, std.algorithm, std.typecons;

void main(){

	alias Tuple!(int, "x", int, "y") Point;
	int W, H, N;
	auto input = readln.split.map!(to!int);
	W = input[0], H = input[1], N = input[2];
	int total;
	Point before;
	foreach (i; 0..N) {
		input = readln.split.map!(to!int);
		Point p;
		p.x = input[0], p.y = input[1];
		if (i > 0) {
			int dx = p.x - before.x, dy = p.y - before.y;
			if (dx * dy > 0) {
				dx = dx > 0 ? dx : -dx;
				dy = dy > 0 ? dy : -dy;
				total += max(dx, dy);
			} else {
				dx = dx > 0 ? dx : -dx;
				dy = dy > 0 ? dy : -dy;
				total += dx + dy;
			}
		}
		before = p;
	}
	total.writeln;
}