#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 int main(){ int H,W,N; cin>>H>>W>>N; vector a(H,vector(W)); rep(i,N){ int x,y; cin>>x>>y; x--,y--; a[x][y] = 1; } long long ans = 0; vector c(W); rep(i,H){ rep(j,W){ if(a[i][j])c[j] = 0; else c[j]++; } stack> S; S.emplace(-1,-1); long long cur = 0; rep(j,W){ while(S.top().second >= c[j]){ auto p = S.top(); S.pop(); cur -= p.second * (p.first - S.top().first); } cur += c[j] * (j - S.top().first); S.emplace(j,c[j]); ans += cur; } } cout<