import sequtils,strutils var W = stdin.readline.parseInt H = stdin.readline.parseInt mark : array[1..1_000_000,int] num : array[1..1_000_000,int] ans : int64 N = stdin.readline.parseInt a,b : int y,x : int fm,fn : array[1..1_000_000,bool] flag : bool (x,y) = (1,1) for i in 1..N: (a,b) = stdin.readline.split.map(parseInt) if fm[a] == false: mark[a] = H - y if fn[b] == true: mark[a] += 1 x += 1 fm[a] = true flag = false else: mark[a] -= 1 flag = true if fn[b] == false: num[b] = W - x + 1 y += 1 fn[b] = true elif flag == false: num[b] -= 1 for i in 1..W: ans += mark[i].int64 for i in 1..H: ans += num[i].int64 echo ans