#include #include #include #include using namespace std; typedef long long int ll; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll h,w; cin >> h >> w; int q; cin >> q; ll res=-q; set hh,ww; while(q--){ int x,y; cin >> x >> y; x--; y--; hh.insert(x); ww.insert(y); } res+=(ll)hh.size()*w+(ll)ww.size()*h-(ll)hh.size()*(ll)ww.size(); cout << res << endl; }