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) SK[i] = [a,b] #マーク順に並べる SK.sort() ans = 0 i = 0 while i < N: s = SK[i][0] k = SK[i][1] cntK = 1 i += 1 if i == N: ans += H-cntK break #マークが同じカードが何枚あるかをcntに格納 while SK[i][0] == s: cntK += 1 i += 1 if i == N: ans += H-cntK break ans += H-cntK if i != N else 0 if W > len(B): ans += (W-len(B))*len(A) print(ans)