#include <bits/stdc++.h>
#define fir first
#define sec second
#define PB push_back
#define MP make_pair

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i < (int)(n); ++i)

template <class T> void chkmax(T& x, T y) { x = (x > y ? x : y); }
template <class T> void chkmin(T& x, T y) { x = (x < y ? x : y); }

typedef long long LL;
typedef pair <int, int> pii;
typedef vector <int> vi;

const int N = 2e5 + 5;

int n, m, K;
int a[N], last[N];

vi e[N];

struct fenwick {
    int d[N];

    void init(int sz){
        memset(d, 0, sizeof(d));
        rep1(i, sz + 1){
            a[i] = 1;
            modify(i, 1);
        }
    }

    void modify(int x, int val){
        while (x <= m){
            d[x] += val;
            x += (x & -x);
        }
    }

    int query(int x){
        int ret = 0;
        while (x){
            ret += d[x];
            x -= (x & -x);
        }
        return ret;
    }
} fenwick;

int main(){
    scanf("%d%d%d", &n, &m, &K);
    rep1(i, n + 1) last[i] = m;
    fenwick.init(m);
    rep(i, K){
        int x, y; scanf("%d%d", &x, &y);
        e[x].PB(y);
        chkmin(last[x], y - 1);
    }

    LL ret = 0;
    rep1(i, n + 1){
        for (auto j : e[i]) if (a[j]){
           a[j] = 0;
           fenwick.modify(j, -1);
        }
        if (a[1]){
            ret += last[i];
            ret += max(0, fenwick.query(last[1]) - fenwick.query(last[i]));
        } else {
            ret += fenwick.query(last[1]);
        }
    }

    printf("%lld\n", ret);

    return 0;
}
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb(i) push_back(i)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=b;i>=a;i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define VI vector<int>
#define VLL vector<ll>
#define MPII map<pair<int,int>,int>
#define mp make_pair
#define PQI priority_queue<int>
#define lowbit(x) x&-x
#define debug(a) cout<<#a<<'='<<a<<'\n'
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N = 1e6+10;
const int INF = 0x3f3f3f3f;
const int inf = - INF;
const int mod = 1e9+7;
const double pi = acos(-1.0);
const double eps=1e-5;
const int M = 2e5 + 10;
struct point{
    int x,y;
    bool operator < (point p) const{
        return x == p.x ? y < p.y : x < p.x;
    }
}p[N];
int vis[M],c[M];
int getsum(int x){
    int res = 0;
    while (x){
        res += c[x];
        x -= lowbit(x);
    }
    return res;
}
void update(int x, int y, int n){
    while (x <= n){
        c[x] += y;
        x += lowbit(x);
    }
}
int main()
{
    int h, w, m;
    scanf("%d%d%d",&h, &w, &m);
    int mx = INF, my = INF;
    for (int x, y, i = 1; i<= m; i++){
        scanf("%d%d", &x, &y);
        p[i] = (point){x,y};
        if (y == 1)
            mx = min (mx ,x);
        if (x == 1)
            my = min (my ,y);
    }
    for (int i = mx + 1; i <= h; i++){
        p[++m].x = i;
        p[m].y = 1;
    }
    for (int i = my + 1; i <= w; i++){
        p[++m].x = 1;
        p[m].y = i;
    }
    sort(p + 1, p + 1  + m);
    ll cnt = 0, pos = 1;
    for (int i = 1; i <= m; i++){
        if (!vis[p[i].y]){
            vis[p[i].y] = 1;
            update(p[i].y, 1, w);
        }
        if (i == m || p[i].x != p[i + 1].x){
            cnt += getsum(w) - getsum(p[pos].y - 1);
            pos = i + 1;
        }
    }
    printf("%lld\n", 1ll * h * w - cnt);
    return 0;
}