X, Y = 0, 1

W, H, N = gets.split.map &:to_i
P = N.times.map{gets.split.map &:to_i}

p P.each_cons(2).map{|from ,to|
  dx = to[X] - from[X]
  dy = to[Y] - from[Y]
  dy < 0 ? dx.abs + dy.abs : [dx.abs, dy.abs].max
}.inject(:+)