#include <vector>
#include <functional>

using namespace std;

template<typename T>
class SegmentTree
{
    int n;
    function<T(T,T)> op;
    vector<T> V;

    T q(int l, int r)
    {
        if (l >= r)
            return V[0];
        T a = q((l+1)/2, r/2);
        if (l%2 != 0)
            a = op(a, V[l]);
        if (r%2 != 0)
            a = op(a, V[r-1]);
        return a;
    }

public:
    SegmentTree(int n_, function<T(T,T)> op, T init):
        op(op)
    {
        n = 1;
        while (n < n_)
            n *= 2;
        V = vector<T>(2*n, init);
        for (int i=n-1; i>0; i--)
            V[i] = op(V[i*2], V[i*2+1]);
    }

    T get(int p) const
    {
        return V[p+n];
    }

    void set(int p, T v)
    {
        p += n;
        V[p] = v;
        for (p/=2; p>0; p/=2)
            V[p] = op(V[p*2], V[p*2+1]);
    }

    //  init OP v[l] OP v[l+1] OP ... OP v[r-1]
    T query(int l, int r)
    {
        return q(l+n, r+n);
    }
};

#include <iostream>
#include <set>
#include <map>

int main()
{
    int N, M, Q;
    cin>>N>>M>>Q;
    vector<int> T(Q), X(Q);
    vector<long long> Y(Q);
    for (int i=0; i<Q; i++)
    {
        cin>>T[i]>>X[i]>>Y[i];
        X[i]--;
    }

    set<long long> YS;
    YS.insert(0);
    for (long long y: Y)
        YS.insert(y);
    vector<long long> YV;
    map<long long, int> YI;
    for (long long y: YS)
    {
        YI[y] = (int)YV.size();
        YV.push_back(y);
    }
    int n = (int)YS.size();

    SegmentTree<long long> AC(n, [&](long long x, long long y){return x+y;}, 0);
    SegmentTree<long long> AS(n, [&](long long x, long long y){return x+y;}, 0);
    SegmentTree<long long> BC(n, [&](long long x, long long y){return x+y;}, 0);
    SegmentTree<long long> BS(n, [&](long long x, long long y){return x+y;}, 0);
    AC.set(0, N);
    BC.set(0, M);
    long long ans = 0;

    vector<long long> a(N), b(M);

    for (int q=0; q<Q; q++)
    {
        auto &a2 = T[q]==1 ? a : b;
        auto &AC2 = T[q]==1 ? AC : BC;
        auto &AS2 = T[q]==1 ? AS : BS;
        auto &b2 = T[q]==2 ? a : b;
        auto &BC2 = T[q]==2 ? AC : BC;
        auto &BS2 = T[q]==2 ? AS : BS;

        ans -= BS2.query(YI[a2[X[q]]], n) + BC2.query(0, YI[a2[X[q]]])*a2[X[q]];
        AC2.set(YI[a2[X[q]]], AC2.get(YI[a2[X[q]]])-1);
        AS2.set(YI[a2[X[q]]], AS2.get(YI[a2[X[q]]])-a2[X[q]]);
        a2[X[q]] = Y[q];
        AC2.set(YI[a2[X[q]]], AC2.get(YI[a2[X[q]]])+1);
        AS2.set(YI[a2[X[q]]], AS2.get(YI[a2[X[q]]])+a2[X[q]]);
        ans += BS2.query(YI[a2[X[q]]], n) + BC2.query(0, YI[a2[X[q]]])*a2[X[q]];
        cout<<ans<<endl;
    }
}

#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)

using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

const int MAXN = 234567;
int bit[MAXN];
bool vis[MAXN];
vector<int> candH[MAXN];
vector<int> candW[MAXN];

int query(int x) {
    int res = 0;
    while (x) {
        res += bit[x];
        x -= (x & -x);
    }
    return res;
}

void add(int x, int N) {
    vis[x] = 1;
    while (x <= N) {
        bit[x] += 1;
        x += (x & -x);
    }
}

int main() {
    int H, W, M;
    scanf("%d %d %d", &H, &W, &M);
    int mxH = H, mxW = W;
    for (int i = 0; i < M; i++) {
        int X, Y;
        scanf("%d %d", &X, &Y);
        if (Y == 1) mxH = min(X - 1, mxH);
        if (X == 1) mxW = min(Y - 1, mxW);
        candH[X].push_back(Y);
        candW[Y].push_back(X);
    }
    LL ans = (LL)mxH * mxW;
    for (int i = 1; i <= mxH; i++) {
        if (candH[i].empty()) continue;
        sort(candH[i].begin(), candH[i].end());
        for (int w : candH[i]) {
            if (w > mxW || vis[w]) continue;
            add(w, W);
        }
        int ft = candH[i].front();
        int offs = query(W) - query(ft - 1);
        assert((ft > mxW && offs == 0) || (ft <= mxW));
        ans -= offs;
    }
    // printf("ans = %lld\n", ans);
    for (int i = 1; i <= mxH; i++) {
        sort(candH[i].begin(), candH[i].end());
        if (candH[i].empty()) ans += (W - mxW);
        else if (candH[i].front() > mxW) {
            ans += (candH[i].front() - mxW - 1);
        }
    }
    for (int i = 1; i <= mxW; i++) {
        sort(candW[i].begin(), candW[i].end());
        if (candW[i].empty()) ans += (H - mxH);
        else if (candW[i].front() > mxH) {
            ans += (candW[i].front() - mxH - 1);
        }
    }
    printf("%lld\n", ans);
    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
by Benq;
*/
