from collections import deque H, W, N = map(int, input().split()) A = [] B = [] for i in range(N): a, b = map(int, input().split()) A.append(a - 1) B.append(b - 1) c = [[0 for _ in range(W)] for _ in range(H)] for i in range(N): c[A[i]][B[i]] = 1 length = [[0 for _ in range(W)] for _ in range(H)] for j in range(W): if c[H - 1][j] == 0: length[H - 1][j] = 1 else: length[H - 1][j] = 0 for i in reversed(range(H - 1)): for j in range(W): if c[i][j] == 0: length[i][j] = length[i + 1][j] + 1 else: length[i][j] = 0 # print(length) ans = 0 dq = deque() dq.append([-1, -1]) now = 0 for i in range(H): for j in range(W): idx = j while True: if len(dq) == 0: break height, width = dq.pop() if height < length[i][j]: dq.append([height, width]) break now -= height * width idx -= width now += length[i][j] * (j - idx + 1) ans += now dq.append([length[i][j], j - idx + 1]) while len(dq): dq.pop() now = 0 print(ans)