#include #include using namespace std; int main() { while (cin) { int w,h,n; cin >> w >> h >> n; if (w==0 && h==0 && n==0) break; bool wp[w]; bool hp[h]; bool pd[w+h-1], ld[w+h-1]; memset(wp,0,w); memset(hp,0,h); memset(pd,0,w+h-1); memset(ld,0,w+h-1); for (int i = 0; i < n; i++) { int x,y; cin >> x >> y; x--; y--; wp[x] = true; hp[y] = true; pd[x+(h-y-1)] = true; ld[(w-x-1)+(h-y-1)] = true; } int sz = w*h/8+1; unsigned char poile[sz]; memset(poile,0,sz); int volny = 0; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { if (wp[x]) continue; if (hp[y]) continue; if (pd[x+(h-y-1)]) continue; if (ld[(w-x-1)+(h-y-1)]) continue; volny++; } } cout << volny << endl; } return 0; }