// God put a smile upon your face <3

#include <bits/stdc++.h>

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

using namespace std;

bool check(ll n, ll pos)
{
    return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
    return n = n | (1LL << pos);
}

vector < ll > g[200005];

struct BIT
{
    vector < ll > tree;
    ll n;

    BIT(ll n) : n(n), tree(n + 3, 0) {}

    void init()
    {
        tree.assign(n + 3, 0);
    }

    ll query(ll idx)
    {
        ll sum=0;
        while(idx>0)
        {
            sum+=tree[idx];
            idx -= idx & (-idx);
        }
        return sum;
    }

    void update(ll idx, ll x) //n is the size of the array, x is the number to add
    {
        while(idx<=n)
        {
            tree[idx]+=x;
            idx += idx & (-idx);
        }
    }
} bit(200002);

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> n >> m >> k)
    {
        ans = 0;

        for(ll i = 1; i <= m; i++) g[i].clear();

        bool on = 0;

        for(ll i = 1; i <= k; i++)
        {
            ll u, v;

            cin >> u >> v;

            g[v].pb(u);
        }

        bit.init();

        for(ll i = 1; i <= m; i++)
        {
            sort(g[i].rbegin(), g[i].rend());

            if(i == 1 && !g[i].empty())
            {
                for(ll j = g[i].back(); j <= n; j++)
                {
                    bit.update(j,1);
                    ans++;
                }

                continue;
            }

            if(!g[i].empty() && g[i].back() == 1) on = 1;
			ll lim = 2e5 + 1;


            if(on)
            {
				for(auto it: g[i])
				{
					ll x = bit.query(it);
					if(it > 1)  x -= bit.query(it - 1);
					if(x == 0) bit.update(it,1);
				}

				ans += bit.query(lim);
            }
            else
            {
                for(auto it: g[i])
                {
                    ans++;

                    ll obs = bit.query(lim) - bit.query(it);

                    ans += obs;

                    ll x = bit.query(it);
					if(it > 1)  x -= bit.query(it - 1);
					if(x == 0) bit.update(it,1);

                    lim = it - 1;
                }

            }

//            cout << ans << "\n";

        }

        ans = (n * m) - ans;

        cout << ans << "\n";
    }


}



#include <bits/stdc++.h>

using namespace std;

#define ar array
#define ll long long

const int MAX_N = 1e5 + 1;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LINF = 1e18;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <class T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <class K, class V> using ordered_map = tree<K, V, less<K>, rb_tree_tag, tree_order_statistics_node_update>;

void solve() {
    int r, c, n; cin >> r >> c >> n;
    vector<ar<int,2>> a(n);
    vector<int> rb(r + 1, c), cb(c + 1, r);
    for (auto &[x, y] : a) {
        cin >> x >> y;
        rb[x] = min(rb[x], y - 1);
        cb[y] = min(cb[y], x - 1);
    }
    ll ans = 0;
    for (int i = 1; i <= rb[1]; i++) ans += cb[i]; // all squares that can be reached by right-down
    vector<ar<int,2>> v;
    for (int i = 2; i <= cb[1]; i++) v.push_back({rb[i], i});
    sort(v.begin(), v.end());
    ordered_set<int> os;
    for (int i = 0, j = 0; i < v.size(); i++) {
        while (j < min(v[i][0], rb[1])) os.insert(cb[++j]);
        int dup = os.size() - os.order_of_key(v[i][1]);
        ans += rb[v[i][1]] - dup;
    }
    cout << ans << "\n";
}   

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int tc = 1;
    // cin >> tc;
    for (int t = 1; t <= tc; t++) {
        // cout << "Case #" << t  << ": ";
        solve();
    }
}