ln=[] card=[] for i in range(3): ln.append(int(input())) for i in range(ln[2]): card.append(list(map(int,input().split()))) exist=[[0 for i in range(ln[j]+1)] for j in range(2)] for i in range(2): for j in range(ln[2]): if exist[i][card[j][i]]==0: exist[i][card[j][i]]=1 n=ln[0]-exist[0].count(1) m=ln[1]-exist[1].count(1) ans=(ln[0]*ln[1]-n*m)-ln[2] print(ans)