#include #include #include #include #include #include #include #include static int const INF{100000000}; int main(int, char**) { int w, h, n; std::cin >> w >> h >> n; std::vector> sks(n); for(int i{}; i < n; ++i) { int s, k; std::cin >> s >> k; sks[i] = std::make_pair(s, k); } auto it = std::unique(begin(sks), end(sks), [](auto x, auto y) { return x.first == y.first; }); int c1 = std::distance(begin(sks), it); it = std::unique(begin(sks), end(sks), [](auto x, auto y) { return x.second == y.second; }); int c2 = std::distance(begin(sks), it); long long ans = w * h - (h - c1) * (w - c2) - n; std::cout << ans << std::endl; return 0; }