intmain(){ cin >> n >> m >> q; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) xx[i].insert(j), yy[j].insert(i); while (q--) { int x, y; cin >> x >> y; if (xx[x].find(y) != xx[x].end()) { xx[x].erase(y); yy[y].erase(x); } else { vector<int> v; auto i = xx[x].lower_bound(y); if (i != xx[x].end()) v.push_back(*i); if (i != xx[x].begin()) v.push_back(*(--i)); for (auto t : v) xx[x].erase(t), yy[t].erase(x); v.clear(); i = yy[y].lower_bound(x); if (i != yy[y].end()) v.push_back(*i); if (i != yy[y].begin()) v.push_back(*(--i)); for (auto t : v) yy[y].erase(t), xx[t].erase(y); } } for (int i = 1; i <= n; i++) ans += xx[i].size(); cout << ans; return0; }