W=int(input()) H=int(input()) N=int(input()) A=set() #マーク B=set() #数字 X=0 for _ in range(N): F=0 S,K=map(int,input().split()) if S not in A: A.add(S) X+=(H-len(B)-(K not in B)) else: F=1 X-=1 if K not in B: B.add(K) X+=(W-len(A)) elif F==0: X-=1 print(X)