#include using namespace std; #pragma GCC target("avx2") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") template inline bool chmax(T &a, T b) { return ((a < b) ? (a = b, true) : (false)); } template inline bool chmin(T &a, T b) { return ((a > b) ? (a = b, true) : (false)); } #define rep(i, n) for (int i = 0; i < (long long)(n); i++) #define rep2(i, m ,n) for (int i = (m); i < (long long)(n); i++) #define REP(i, n) for (long long i = 1; i < (long long)(n); i++) typedef long long ll; #define updiv(N,X) (N + X - 1) / X #define l(n) n.begin(),n.end() #define YesNo(Q) Q==1?cout<<"Yes":cout<<"No" using P = pair; const int MOD = 998244353LL; ll solve(vector &w){ set st; vector> v; rep(i,w.size()){v.push_back(pair(w[i],i));} sort(l(v)); st.insert(-1); int n = w.size(); st.insert(n); ll ans = 0; rep(i,n){ auto t = st.lower_bound(v[i].second); auto k = t;k--; ans += (v[i].second-(ll)(*k)) * ((ll)(*t)-v[i].second) * v[i].first; st.insert(v[i].second); } return ans; } int main(){ ll h,w,n;cin>>h>>w>>n; vector> v(h,vector(w,0)); rep(i,n){ int a,b;cin>>a>>b;a--;b--; v[a][b] = 1; } // otp(v); //vector> t(h,vector(w,0)); rep(i,h){ ll now = 0; rep(j,w){now++;if(v[i][w-j-1]==1){now = 0;}v[i][w-j-1] = now;} } // otp(v); ll ans = 0; rep(i,w){vector w(h); rep(j,h){w[j] = v[j][i];} // rep(j,h){cout << w[j] << " ";}cout< y={2,1,3,4,5}; //cout << solve(y) << endl; //cout << solveg(y) << endl; cout << ans << endl; }