#include #include #include int Row[50000]; int Col[50000]; int Diag1[100000]; int Diag2[100000]; int main() { int w, h, n; while(1) { memset(Row, 0, sizeof(Row)); memset(Col, 0, sizeof(Col)); memset(Diag1, 0, sizeof(Diag1)); memset(Diag2, 0, sizeof(Diag2)); scanf("%d%d%d", &w, &h, &n); if(!((w) || (h) || (n))) { return 0; } int x, y; for(int i = 0; i < n; i++) { scanf("%d%d", &x, &y); Row[x] = 1; Col[y] = 1; Diag1[(x - y) + 30000] = 1; Diag2[(x + y) + 30000] = 1; } int count = 0; for(int x = 1; x <= w; x++) { if(Row[x]) { continue; } for(int y = 1; y <= h; y++) { if(Col[y]) { continue; } if(!((Diag1[(x - y) + 30000]) || (Diag2[(x + y) + 30000]))) { count++; } } } printf("%d\n", count); } }