import java.util.Scanner; import java.util.TreeSet; public class Cardmatch { public static void main(String[] args) { Scanner s = new Scanner(System.in); int W = s.nextInt(),H = s.nextInt(),N = s.nextInt(); int[] S = new int[N]; int[] K = new int[N]; TreeSet Mark = new TreeSet<>(); TreeSet Number = new TreeSet<>(); for(int i = 0;i < N ;i++){ S[i] = s.nextInt(); K[i] = s.nextInt(); } s.close(); long count = 0; for(int i = 0;i < N;i++){ if(Mark.contains(S[i]) && Number.contains(K[i])){ count--; }else if(Mark.contains(S[i])){ count += (W - Mark.size()-1); Number.add(K[i]); }else if(Number.contains(K[i])){ count += (H - Number.size()-1); Mark.add(S[i]); }else{ count += (W-Mark.size() + H-Number.size() -2); Mark.add(S[i]); Number.add(K[i]); } } System.out.println(count); } }