### main

w, h, n = gets.strip.split(' ').map{|s| s.to_i}

pts = n.times.map{gets.strip.split(' ').map{|s| s.to_i - 1}}

x0, y0 = pts.shift
sumd = 0

for pt1 in pts
  x1, y1 = pt1
  dx = x1 - x0
  dy = y1 - y0

  if dx < 0
    dx = -dx
    dy = -dy
  end

  if dy >= 0
    sumd += [dx, dy].max
  else
    sumd += (dx - dy)
  end

  x0, y0 = x1, y1
end

puts sumd