h, w, n = map(int, input().split()) C = [[1] * w for _ in range(h)] for _ in range(n): a, b = map(int, input().split()) C[a - 1][b - 1] = 0 for j in range(w): for i in range(1, h): if C[i][j] != 0: C[i][j] = C[i - 1][j] + 1 ans = 0 for row in C: tot = 0 st = [] for c in row: if c == 0: st = [] tot = 0 continue a = 1 while st and st[-1][0] >= c: tot -= st[-1][0] * st[-1][1] a += st.pop()[1] st.append((c, a)) tot += c * a ans += tot print(ans)