#include #include #include using namespace std; typedef long long ll; int s[111], k[111]; int main(void) { ll w, h, n; scanf("%lld%lld%lld", &w, &h, &n); for (int i = 0; i < n; i++) { scanf("%d%d", s+i, k+i); } ll res = 0; set uw, hw; for (int i = 0; i < n; i++) { if (uw.count(s[i]) == 0) { uw.insert(s[i]); res += h; } if (hw.count(k[i]) == 0) { hw.insert(k[i]); res += w; } } res -= uw.size()*hw.size(); res -= n; printf("%lld\n", res); return 0; }