#include #define rep(i, n) for(long long i = 0; i < n; i++) #define ALL(v) (v).begin(), (v).end() using namespace std; using lint = long long; int main() { lint w, h, n; cin >> w >> h >> n; vector gyo(w, 0), retsu(h, 0); rep(i, n) { int s, k; cin >> s >> k; s--; k--; gyo[s]++; retsu[k]++; } lint ans = 0; rep(i, w) { if (gyo[i] > 0) { ans += h - gyo[i]; } } lint cnt = 0; rep(i, w) { if (gyo[i] == 0) { cnt++; } } rep(i, h) { if (retsu[i] > 0) { ans += cnt; } } cout << ans << endl; }