import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Queue; public class No11 { public static void main(String[] args) throws IOException{ //カードマッチ String[] text = readStr(); int W = Integer.parseInt(text[0]); int H = Integer.parseInt(text[1]); int N = Integer.parseInt(text[2]); int S , K , count = 0; Queue qu = new ArrayDeque<>(); int[][] hand = new int[W + 1][H + 1]; for(int i = 0;i < N;i++) { S = Integer.parseInt(text[i + 3].split(" ")[0]); K = Integer.parseInt(text[i + 3].split(" ")[1]); hand[S][K] = 1; qu.add(S); qu.add(K); } for(int i = 0;i < N;i++) { S = qu.poll(); K = qu.poll(); for(int kn = 1;kn <= H;kn++) { if(hand[S][kn] != 1) { count++; hand[S][kn] = 1; } } for(int sn = 1;sn <= W;sn++) { if(hand[sn][K] != 1) { count++; hand[sn][K] = 1; } } } System.out.println(count); } public static String[] readStr() throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ArrayList list = new ArrayList<>(); do { list.add(br.readLine()); }while(br.ready()); br.close(); String[] text = new String[list.size()]; list.toArray(text); return text; } }