#include #include #include #include #include #define W_MAX 1000000 #define H_MAX 1000000 #define N_MAX 100 using namespace std; typedef long long LL; int main() { LL W, H, ans; int N, S, K; unordered_set Sset, Kset; cin >> W >> H >> N; for (int i = 0; i < N; ++i) { cin >> S >> K; Sset.insert(S); Kset.insert(K); } ans = -N; for (int w = 1; w <= W; ++w) { for (int h = 1; h <= H; ++h) { auto sit = Sset.find(w); auto kit = Kset.find(h); if (sit != Sset.end() || kit != Kset.end()) ++ans; } } cout << ans; return 0; }