import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.util.Scanner; import java.util.TreeMap; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int W = scan.nextInt(); int H = scan.nextInt(); int N = scan.nextInt(); long ans = 0; int []a = new int[H + 1]; Arrays.fill(a, 0); // 隣接リスト Map> map = new TreeMap>(); for(int i = 0; i < N; i++) { int S = scan.nextInt(); int K = scan.nextInt(); a[K] = 1; if(!map.containsKey(S)) { ArrayList list = new ArrayList(); list.add(K); map.put(S, list); }else { map.get(S).add(K); } } scan.close(); int cnt = 0; for(int i = 1 ; i <= H; i++) { if(a[i] == 1) { cnt ++; } } for(int i = 1; i <= W; i++) { if(map.containsKey(i)) { ans += (long) (H - map.get(i).size()); }else { ans += (long) cnt; } } System.out.println(ans); } }