import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.util.StringTokenizer; /** * * @author cteam07 */ public class ith { static int pole[][]; /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line, token; StringTokenizer st; int x, y, n, kx, ky; while(true) { int sum = 0; line = br.readLine(); st = new StringTokenizer(line); try { token = st.nextToken(); x = Integer.parseInt(token); token = st.nextToken(); y = Integer.parseInt(token); token = st.nextToken(); n = Integer.parseInt(token); if(x == 0 && y == 0 && n == 0) break; if(x < 1 || x > 20000 || y < 1 || y > 20000 || n < 0 || n > (x*y)) continue; pole = new int[x][y]; for(int i = 0; i < n; i++) { line = br.readLine(); st = new StringTokenizer(line); token = st.nextToken(); kx = Integer.parseInt(token); token = st.nextToken(); ky = Integer.parseInt(token); if(kx < 1 || kx > x || ky < 1 || ky > y) continue; vyplnRadek(kx-1); vyplnSloupec(ky-1); vyplnLP(kx-1, ky-1); vyplnPL(kx-1, ky-1); } } catch(Exception ex) { //System.out.println(ex.toString()); continue; } for (int i = 0; i < pole.length; i++) { for (int j = 0; j < pole[i].length; j++) { if(pole[i][j] == 0) sum++; } } System.out.println(sum); } } public static void vyplnRadek(int x) { for(int i = 0; i < pole.length; i++) { pole[x][i] = 1; } } public static void vyplnSloupec(int y) { for(int i = 0; i < pole[0].length; i++) { pole[i][y] = 1; } } public static void vyplnLP(int x, int y) { int i = x+1; int j = y+1; for(; (i < pole.length) && (j < pole[0].length); i++, j++) { pole[i][j] = 1; } i = x-1; j = y-1; for(; (i >= 0) && (j >= 0); i--, j--) { pole[i][j] = 1; } } public static void vyplnPL(int x, int y) { int i = x-1; int j = y+1; for(; (i >= 0) && (j < pole[0].length); i--, j++) { pole[i][j] = 1; } i = x+1; j = y-1; for(; (i < pole.length) && (j >= 0); i++, j--) { pole[i][j] = 1; } } }