#include<bits/stdc++.h>
using ll = long long int;
using namespace std;
#define sync ios_base::sync_with_stdio(false); cin.tie(NULL) 
using ld = long double;
#define input(arr,n) for(ll i1=0;i1<n;i1++ )cin>>arr[i1]
#define mod 1000000007
#define F first
#define S second 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
//recursions\
#pragma comment(linker, "/stack:200000000")
//loops\
#pragma GCC optimize("unroll-loops")
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>//s.order_of_key(val)->(strictly less than val) *s.find_by_order(ind)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

vector<string> split(const string& s, char c) {
    vector<string> v; stringstream ss(s); string x;
    while (getline(ss, x, c)) v.push_back(x); return move(v);
}
template<typename T, typename... Args>
inline string arrStr(T arr, int n) {
    stringstream s; s << "[";
    for(int i = 0; i < n - 1; i++) s << arr[i] << ",";
    s << arr[n - 1] << "]";
    return s.str();
}
#define EVARS(args...) {__evars_begin(__LINE__); __evars(split(#args, ',').begin(), args);}
inline void __evars_begin(int line) { cerr << "#" << line << ": "; }
template<typename T> inline void __evars_out_var(vector<T> val) { cerr << arrStr(val, val.size()); }
template<typename T> inline void __evars_out_var(T* val) { cerr << arrStr(val, 10); }
template<typename T> inline void __evars_out_var(T val) { cerr << val; }
inline void __evars(vector<string>::iterator it) { cerr << endl; }
template<typename T, typename... Args>
inline void __evars(vector<string>::iterator it, T a, Args... args) {
    cerr << it->substr((*it)[0] == ' ', it->length()) << "=";
    __evars_out_var(a);
    cerr << "; ";
    __evars(++it, args...);
}
const int N = 1e6 + 5;

ll get(vector<ll>&v, ll idx)
{
    ll ans = 0;
    while(idx >= 0)
    {
        ans += v[idx];
        idx = (idx & (idx+1)) - 1;
    }
    return ans;
}
void upd(vector<ll>&v, ll idx, ll val)
{
    while(idx < v.size())
    {
        v[idx] += val;
        idx |= (idx + 1);
    }
}
int main()
{
	sync;
	clock_t clk = clock();
    ll h, w, m;
    cin >> h >> w >> m;
    set<pair<ll, ll> > v;
    ll fir_row = w + 1, fir_col = h + 1;
    for(int i = 0; i < m; i++){
        ll x, y;
        cin >> x >> y;
        v.insert({x, y});
        if(x == 1)
            fir_row = min(fir_row, y);
        if(y == 1)
            fir_col = min(fir_col, x);
    }
    
    ll ans = h * w; 
    vector<ll> bitx(2e5 + 5);
    for(int i = fir_col; i <= h; i++)
        v.insert({i, 1});
    for(int i = fir_row; i <= w; i++)
        v.insert({1, i });
    vector<bool> done(2e5 + 5, false), same(2e5 + 5, false);
    for(auto [x, y]: v){
        if(!same[x])
            ans -= get(bitx, 2e5 + 1) - get(bitx, y) + 1;
        else if(!done[y])
            ans--;
        if(!done[y]){
            done[y] = true;
            upd(bitx, y, 1);
        }
        same[x] = true;
    }
    cout << ans;
 	//cerr << '\n'<<"Time (in s): " << double(clock() - clk) * 1.0 / CLOCKS_PER_SEC << '\n';	
}

#include <bits/stdc++.h>
//#include <chrono>
//#pragma GCC optimize("O3")
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()

using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

ll N,M,H,W,Q,K,A,B;
string S;
using P = pair<ll, ll>;
const ll INF = (1LL<<60);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}
template<class T> void my_printv(std::vector<T> v,bool endline = true){
    if(!v.empty()){
        for(std::size_t i{}; i<v.size()-1; ++i) std::cout<<v[i]<<" ";
        std::cout<<v.back();
    }
    if(endline) std::cout<<std::endl;
}

bool ok(int n){
    for(int p : {10, 8}) {
        int cn = n;
        while (cn) {
            if (cn % p == 7) return false;
            cn /= p;
        }
    }
    return true;
}

template <class T> class BIT {
    //T has operator "+=" and can be initialized with 0.
    unsigned int n;
    vector<T> bitree;
public:
    BIT(unsigned long _n) : bitree(_n + 1, 0) {
        n = _n;
    }

    void add(int id, T x) {
        ++id;
        while (id <= n) {
            bitree[id] += x;
            id += id & -id;
        }
    }

    T sum(int id) {
        ++id;
        T temp(0);
        while (id > 0) {
            temp += bitree[id];
            id -= id & -id;
        }
        return temp;
    }
};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cin>>H>>W>>M;
    vec up(W, H), left(H, W);
    rep(i, M){
        ll x, y; cin>>x>>y;
        --x; --y;
        chmin(up[y], x);
        chmin(left[x], y);
    }
    ll res = 0;
    rep(i, up[0]) res += left[i];
    rep(i, left[0]) res += up[i];
    //cout<<res<<endl;
    BIT<ll> bit(W + 1);
    rep(i, left[0]) bit.add(i, 1);
    priority_queue<P, vector<P>, greater<> > pque;
    rep(i, left[0]) pque.emplace(up[i], i);
    rep(i, up[0]){
        while(!pque.empty()){
            P p = pque.top();
            ll hei = p.first, id = p.second;
            if(hei > i) break;
            pque.pop();
            bit.add(id, -1);
        }
        res -= bit.sum(left[i] - 1);
        //rep(j, W) cout<<bit.sum(j) - (j ? bit.sum(j-1) : 0)<<" \n"[j==W - 1];
        //cout<<bit.sum(left[i] - 1)<<endl;
    }
    cout<<res<<endl;
}
