#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("trapv")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define deb(x) cout << #x << " is " << x << "\n"
#define int long long
#define MOD 1000000007LL
#define mod(x) (x % MOD + MOD) % MOD
#define PI acos(-1)

template <typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;

template <typename T>
using max_heap = priority_queue<T>;

template <class T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename... T>
void read(T &... args) {
	((cin >> args), ...);
}

template <typename... T>
void write(T &&... args) {
	((cout << args), ...);
}

template <typename T>
void readContainer(T &t) {
	for (auto &e : t) read(e);
}

template <typename T>
void writeContainer(T &t) {
	for (const auto &e : t) write(e, " ");

	write("\n");
}

void solve(int tc) {
	int H, W, M;
	read(H, W, M);
	vector<int> X(M), Y(M);
	vector<int> hLimit(H + 1, W), wLimit(W + 1, H);

	for (int i = 0; i < M; i++) {
		read(X[i], Y[i]);
		hLimit[X[i]] = min(hLimit[X[i]], Y[i] - 1);
		wLimit[Y[i]] = min(wLimit[Y[i]], X[i] - 1);
	}

	int ans = 0;

	for (int i = 1; i <= hLimit[1]; i++) {
		ans += wLimit[i];
	}

	vector<pair<int, int>> arr;

	for (int i = 2; i <= wLimit[1]; i++) {
		arr.push_back({hLimit[i], i});
	}

	sort(arr.begin(), arr.end());
	ordered_set<int> st;
	int r = 0;

	for (const auto &ele : arr) {
		while (r < ele.first && r < hLimit[1]) {
			st.insert(wLimit[++r]);
		}

		ans += (hLimit[ele.second] - st.size() + st.order_of_key(ele.second - 1));
	}

	write(ans);
}

signed main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	int tc = 1;
	// read(tc);

	for (int curr = 1; curr <= tc; curr++) solve(curr);

	return 0;
}
#include <bits/stdc++.h>

using namespace std;

const int N = 3e5 + 123;
const int mod = 998244353;

#define int long long

int t[N * 4];

void upd(int v, int tl, int tr, int pos, int val) {
	if(tl == tr) {
		t[v] += val;
		t[v] = max(t[v], 0LL);
		return;
	}
	int tm = (tl + tr) / 2;

	if(pos <= tm)
		upd(v + v, tl, tm, pos, val);
	else upd(v + v + 1, tm + 1, tr, pos ,val);
	t[v] = t[v + v]+ t[v + v + 1];
}

int get(int v, int tl, int tr, int l, int r) {
	if(l > r) return 0;
	if (l == tl && r == tr)
		return t[v];
	int tm = (tl + tr) / 2;
	return (get (v*2, tl, tm, l, min(r,tm))
		+ get (v*2+1, tm+1, tr, max(l,tm+1), r));
}

vector <int> v[N];
int n, m;
 main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> m;
	int q;
	cin >> q;
	for(int i = 1; i <= q; i++) {
		int x, y;
		cin >> x >> y;
		v[y].push_back(x);
	}
	for(int i = 1; i <= n; i++) {
		upd(1, 1, n, i, 1);
	}
	long long ans = n * 1LL*m;


	v[1].push_back(n + 1);
	sort(v[1].begin(), v[1].end());
	for(int j = v[1][0]; j <= n; j++){
		upd(1, 1, n, j, -1);
		ans--;
	}
	for(int i = 2; i <= m; i++) {
		v[i].push_back(n + 1);
		v[i].push_back(0);
		sort(v[i].begin(), v[i].end());
		ans -= v[i].size() - 2;
		int l = 1, r = v[i][1] - 1;

		if(get(1, 1, n, l, r) == r - l + 1 or get(1, 1, n, 1, 1) == 1){
		}else {
			ans -= -get(1, 1, n, l, r) + r - l + 1;
		}
		for(int j = 1; j < v[i].size() - 1; j++) {
			int st = v[i][j] + 1;
			int ed = v[i][j + 1] - 1;
			ans -= max(ed - st + 1 - get(1, 1, n, st, ed), 0LL);
		}
		for(int j = 1; j < v[i].size() - 1; j++) {
			if(v[i][j] >= 1 && v[i][j] <= n){
			upd(1, 1, n, v[i][j], -1);
			}
		}


	}
	cout << ans;
}
//N?























