# coding:UTF-8 import sys MOD = 10 ** 9 + 7 INF = float('inf') H, W, Q = list(map(int, input().split())) # スペース区切り連続数字 YX = [list(map(int, input().split())) for _ in range(Q)] # スペース区切り連続数字(行列) def compress(arr): *XS, = set(arr) XS.sort() return {e: i for i, e in enumerate(XS)} mp = compress([x for y, x in YX]) res = H * W zan = [H] * len(mp) for y, x in YX: idx = mp[x] t = y - 1 if zan[idx] > t: d = zan[idx] - t zan[idx] = t res -= d print("{}".format(res))