W = int(input())#マークの種類 H = int(input())#数字カードの最大値 N = int(input()) SK = [0 for _ in range(N)] A = set() B = set() for i in range(N): a,b = map(int,input().split()) A.add(a) B.add(b) print(H*W-(W-len(A))*(H-len(B)) - N)