#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
int h,w,m;
int f[200005];
ll ans = 0;
int of[200005];
int fw[200005];
ii p[200005];
void up(int x, int v){
    while (x < 200005){
        fw[x] += v;
        x += x&-x;
    }
}
int qu(int x){
    int res = 0;
    while (x){
        res += fw[x];
        x -= x&-x;
    }
    return res;
}
int main(){
    cin >> h>>w>>m;
    for (int i = 1; i <= h; i++){
        f[i] = w+1;
    }
    for (int i = 0; i < m; i++) {
        cin >> p[i].fi >> p[i].se;
        f[p[i].fi] = min(f[p[i].fi],p[i].se);
    }
    sort(p,p+m);
    int id = 0;
    int cur = w;
    for (int i = 1; i <= h; i++){
        while (id < m && p[id].fi == i){
            if (i == 1){
                while (cur >= p[id].se){
                    if (of[cur] == 0){
                        of[cur] = 1;
                        up(cur, 1);
                    }
                    cur--;
                }
            }
            if (of[p[id].se] == 0){
                //printf("toggling %d column\n",p[id].se);
                of[p[id].se] = 1;
                up(p[id].se,1);
            }
            id++;
        }

        int cur;
        if (of[1]) {
            cur = qu(w);
        }
        else cur = qu(w) - qu(f[i]-1);
        //printf("first = %d, %d on\n",f[i],cur);
        ans += cur;
    }
    ll ANS = (ll)h*w;
    ANS -= ans;

    printf("%lld",ANS);
}

#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define Pii pair<int,int>
#define Pll pair<long long,long long>
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
//vector<vector<ll>> dp(n,vector<ll>(n))
//2-dim:vector<vector<Type>> vv(n, vector<Type>(m, d));
//3-dim:vector<vector<vector<Type>>> vvv(n, vector<vector<Type>>(m, vector<Type>(l, d)));

using namespace std;
template<typename T>
struct SegmentTree{
private:
    int n;
    vector<T> node;
    T identity;
public:
    T merge(T x,T y){
        return x+y;
    }
    SegmentTree(vector<T> v,T id){
        int sz=(int)v.size();
        n=1; while(n<sz)n*=2;
        identity=id;
        node.resize(2*n-1,id);
        for(int i=0;i<sz;i++) node[i+n-1]=v[i];
        for(int i=n-2;i>=0;i--){
            node[i]=merge(node[2*i+1],node[2*i+2]);
        }
    }
    void update(int x,T val){
        x+=(n-1);
        node[x]=val;
        while(x>0){
            x=(x-1)/2;
            node[x]=merge(node[2*x+1],node[2*x+2]);
        }
    }
    T query(int a,int b,int idx=0,int l=0,int r=-1){ /* get [a,b) */
        if(r<0) r=n;
        if(r<=a||b<=l) return identity;
        if(a<=l&&r<=b) return node[idx];
        T vl=query(a,b,2*idx+1,l,(l+r)/2);
        T vr=query(a,b,2*idx+2,(l+r)/2,r);
        return merge(vl,vr);
    };
    T operator[](int k){return node[k+n-1];}
};
signed main(){
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    ll h,w,m; cin >> h >> w >> m;
    
    vector<ll> x(m),y(m);
    vector<ll> mix(200200,h+1),miy(200200,w+1);
    vector<ll> cnt(200200,0);
    vector<vector<ll>> G(200200);
    rep(i,m){
        cin >> x[i] >> y[i];
        chmin(miy[x[i]],y[i]);
        chmin(mix[y[i]],x[i]);
        cnt[y[i]]++;
        G[y[i]].pb(x[i]);
    }
    vector<ll> v(h,1);
    SegmentTree<ll> seg(v,0);

    ll ans = 0;
    for(int i=1;i<miy[1];i++){
        ans += (mix[i]-1);
    }
    //cout << ans << endl;
    ll hh = min(h,mix[1]);
    for(int i=1;i<=w;i++){
        if(mix[i]==h+1 && i<miy[1]) continue;
        for(auto u:G[i]){
            seg.update(u-1,0);
        }
        if(i<miy[1]){
            ans += seg.query(mix[i],hh);
            //cout << seg.query(mix[i],hh) << endl;
        }
        else{
            ans += seg.query(0,hh);
            //cout << seg.query(0,hh) << endl;
        }
    }
    cout << ans << endl;

}
// g++ main.cpp -o a.out && ./a.out