#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int W, H, N; cin >> W >> H >> N; vector S(N), K(N); set> hand; set> match; enum { suit = 0, number = 1 }; for(int i=0; i> S[i] >> K[i]; hand.insert(make_tuple(S[i], K[i])); } for(const auto &h : hand) { for(int i=1; i<=W; i++) { if(hand.count(make_tuple(i, get(h))) == 0) { match.insert(make_tuple(i, get(h))); } } for(int i=1; i<=H; i++) { if(hand.count(make_tuple(get(h), i)) == 0) { match.insert(make_tuple(get(h), i)); } } } cout << match.size() << endl; }