#include using namespace std; typedef long long ll; int main() { ll w, h, n; cin>>w>>h>>n; set suits; set nums; for (int i=0; i < n; i++) { ll s, k; cin>>s>>k; suits.insert(s); nums.insert(k); } ll ns = suits.size(); ll nn = nums.size(); cout << ns*nn + (w-ns)*nn - n << endl; return 0; }