module main; import std; void main() { // 入力 auto W = readln.chomp.to!long; auto H = readln.chomp.to!long; auto N = readln.chomp.to!int; auto S = new long[](N), K = new long[](N); auto sSet = new RedBlackTree!long(), kSet = new RedBlackTree!long(); foreach (ref s, ref k; lockstep(S, K)) { readln.chomp.formattedRead("%d %d", s, k); sSet.insert(s); kSet.insert(k); } // 答えの計算 long ans = sSet.length * H + kSet.length * W - sSet.length * kSet.length - N; // 答えの出力 writeln(ans); }