#ifdef _LOCAL
    #include "local_include.hpp"
#else
    #include <bits/stdc++.h>
    using namespace std;
#endif
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

#define fto(i, s, e) for (int i = (s); i <= (e); ++i)
#define fto1(i, s, e) for (int i = (s); i < (e); ++i)
#define fdto(i, s, e) for (int i = (s); i >= (e); --i)
#define fit(it, a) for (auto it = (a).begin(); it != (a).end(); ++it)
#define fat(i, a) for (auto i : (a))

#define ll long long
#define ii pair<int, int>
#define pll pair<ll, ll>
template<class T, class Cmp = less<T>> using oss = tree<T, null_type, Cmp, rb_tree_tag, tree_order_statistics_node_update>;

#define bc __builtin_popcountll
#define y1 ansdj
#define endl '\n'
#define ff first
#define ss second
#define sz(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define bug(...) _bug(cout, __VA_ARGS__)
#define buga(a, s, e) cout << '{'; if (e < s) cout << '}'; else fto (__i, s, e) cout << a[__i] << " }"[__i == e]; cout << endl

template<class T1, class T2> ostream& operator<<(ostream &os, pair<T1, T2> const &v) {
    return os << '(' << v.ff << ", " << v.ss << ')';
}

template<typename T>
void _bug(ostream &os, T const &var) { os << var << endl; }

template<typename T, typename... Args>
void _bug(ostream &os, T const &var, Args const &... args) {
    os << var << ' ';
    _bug(os, args...);
}

double const pi = acos(-1);
#define oo 1000000007
#define OO 1000000000000000003LL
int const maxn = 2e5+3;

int n, m, k;
int row[maxn], col[maxn];
bool check[maxn];
vector<int> store[maxn];

#define multi_test 0
void _main() {
    cin >> n >> m >> k;
    fto (i, 1, n) row[i] = m+1;
    fto (i, 1, m) col[i] = n+1;
    int u, v;
    fto (i, 1, k) {
        cin >> u >> v;
        row[u] = min(row[u], v);
        col[v] = min(col[v], u);
        store[v].push_back(u);
    }

    int mx = n+1;
    ll ans = 0;
    fto (i, 1, n) {
        if (row[i] == 1) {
            mx = i;
            break;
        }
        ans += row[i]-1;
    }

    oss<ii> s;
    fto (i, 1, m) {
        if (col[i] == 1) break;
        ans += s.order_of_key(ii(col[i], 0));
        if (col[i] > mx) ans += col[i] - mx;
        fat (u, store[i]) {
            if (u >= mx) continue;
            if (!check[u]) {
                check[u] = 1;
                s.insert(ii(u, i));
            }
        }
    }

    bug(ans);
}

int main() {
    #ifdef _LOCAL
        freopen("main.inp", "r", stdin);
        freopen("main.out", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    int t = 1;
    if (multi_test) cin >> t;
    while (t--) {
        _main();
    }

    #ifdef _LOCAL
        cerr << 0.001*clock() << endl;
    #endif
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long h , w , m , tree [800020] , ans , mn = 1e9 , num;
vector < int > v [200005];
void up ( int nod , int l , int r , int x )
{
    if ( x < l || r < x ) return;
    if ( l == r )
    {
        tree [nod] = 1;
        return;
    }
    int mid = ( l + r ) / 2;
    up ( nod * 2 , l , mid , x );
    up ( nod * 2 + 1 , mid + 1 , r , x );
    tree [nod] = tree [ nod * 2 ] + tree [ nod * 2 + 1 ];
}
long long qr ( int nod , int l , int r , int x , int y )
{
    if ( x <= l && r <= y ) return tree [nod];
    if ( y < l || r < x ) return 0;
    int mid = ( l + r ) / 2;
    return qr ( nod * 2 , l , mid , x , y ) + qr ( nod * 2 + 1 , mid + 1 , r , x , y );
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    //freopen("milk.in","r",stdin);
    //freopen("milk.out","w",stdout);
    cin >> h >> w >> m;
    for ( int i = 0 ; i < m ; i ++ )
    {
        long long  x , y;
        cin >> x >> y;
        v [y] . push_back ( x );
        if ( y == 1 )
        {
            num ++;
            mn = min ( mn , x );
        }
    }
    for ( int i = mn ; i <= h ; i ++ )
    {
        ans ++;
        up ( 1 , 1 , h , i );
    }
    ans -= num;
    int f = 0;
    for ( int i = 2 ; i <= w ; i ++ )
    {
        if ( v [i] . size () == 0 )
        {
            if ( f ) ans += qr ( 1 , 1 , h , 1 , h );
            continue;
        }
        sort ( v [i] . begin () , v [i] . end () );
        int first = * v [i] . begin ();
        if ( first == 1 ) f = 1;
        if ( f == 0 ) ans += qr ( 1 , 1 , h , first , h );
        else ans += qr ( 1 , 1 , h , 1 , h );
        for ( int j = 0 ; j < v [i] . size () ; j ++ )
        {
            int x = v [i][j];
            if ( qr ( 1 , 1 , h , x , x ) ) ans --;
            up ( 1 , 1 , h , x );
        }
    }
    cout << h * w - m - ans;
}
/*
4 4 2
2 1
1 3
*/
