#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int W,H; cin >> W >> H; vector S(W),K(H); int N; cin >> N; int m = 0,n = 0,answer = -N; while(N--){ int s,k; cin >> s >> k; s--; k--; if(!S.at(s)) S.at(s) = true,m++; if(!K.at(k)) K.at(k) = true,n++; } cout << answer+m*H+W*n-m*n << endl; }