#include #include using namespace std; bool cols[20000]; bool rows[20000]; bool top[40000]; bool bottom[40000]; int X, Y, N; void init() { for(int i = 0; i < 20000; i++) {cols[i] = true; rows[i] = true;} for(int i = 0; i < 40000; i++) {top[i] = true; bottom[i] = true;} } int getTop(int x, int y) { return x + y; } int getBottom(int x, int y) { return x + (Y - y); } int pocetNeohrozenych() { int count = 0; for(int i = 0; i < X; i++) { for(int j = 0; j < Y; j++) { if(cols[i] && rows[j] && top[getTop(i, j)] && bottom[getBottom(i, j)]) count++; } } return count; } int main(){ int x, y; cin >> X >> Y >> N; while(!(X == 0 && Y == 0 && N == 0)) { init(); for(int i = 0; i < N; i++) { cin >> x >> y; x--; y--; cols[x] = false; rows[y] = false; top[getTop(x, y)] = false; bottom[getBottom(x, y)] = false; } cout << pocetNeohrozenych(); cin >> X >> Y >> N; } return 0; }