w, h, n = gets.split.map &:to_i
a = (1..n).map { gets.split.map &:to_i }
total = 0 
a.each_cons(2){|u, v|
    x1, y1 = u 
    x2, y2 = v 
    if (x1 - x2) * (y1 - y2) >= 0
        total += [(x1-x2).abs, (y1-y2).abs].max
    else
        total += (x1-x2).abs + (y1-y2).abs
    end 
}
p total