import java.util.Scanner; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author cteam46 */ public class ith { static boolean[][] pole; static int x,y,n; public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true) { x = sc.nextInt(); y = sc.nextInt(); n = sc.nextInt(); sc.nextLine(); //vzpneme if(x == 0 && y == 0 && n == 0 ) return; pole = new boolean[x+4][y+4]; for (int i = 0; i < n; i++) { int kx,ky ; // System.out.println("yadej kralovnu"); kx = sc.nextInt() ; ky = sc.nextInt(); sc.nextLine(); kx --; ky --; nastavPole(kx, ky); } // vypis(); System.out.println(pocetPoli()); } } public static void vypis() { // System.out.println("--------------------------------------------------------------------"); for (int i = 0; i < y; i++) { for (int j = 0; j < x; j++) { System.out.print(" "+(pole[j][i] ? "1" : "0")); } System.out.print("\n"); // System.out.println("--------------------------------------------------------------------"); } } public static int pocetPoli() { int res = 0; for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { if(pole[i][j] == false) res ++; } } return res; } public static void nastavPole(int kx, int ky) { for (int i = 0; i < y; i++) { pole[kx][i] = true; } for (int j = 0; j < x; j++) { pole[j][ky] = true; } int dy,dx; dy = ky - Math.min(kx, ky); dx = kx - Math.min(kx, ky); while(dx < x && dy < y) { if(dx >= 0 && dx < x && dy >= 0 && dy = 0) { if(dx >= 0 && dx < x && dy >= 0 && dy