w=int(input()) h=int(input()) n=int(input()) ans=0 tate=set() yoko=set() for i in range(n): wi,hi = map(int,input().split()) if wi not in yoko: yoko.add(wi) ans += (h-len(tate)) if hi not in tate: tate.add(hi) ans += (w-len(yoko)) print(ans-n)