#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) using ll = long long; const int inf=1e9+7; const ll longinf=1LL<<60 ; const ll mod=1e9+7 ; int main(){ ll n, h, q; cin >> n >> h >> q; pair>P[q]; rep(i, q){ char c; ll a, b; cin >> c >> a >> b; a--; b--; P[i] = {c, {a, b}}; } ll iro[101010] = {}; ll tate=0, yoko=0; bool tatecheck[101010]={}, yokocheck[101010] = {}; for(int i=q-1; i>=0; i--){ if(P[i].first=='C' && !tatecheck[P[i].second.first]){ tate++; iro[P[i].second.second]+=(ll)(n-yoko); tatecheck[P[i].second.first]=true; } else if(P[i].first=='R' && !yokocheck[P[i].second.first]){ yoko++; iro[P[i].second.second]+=(ll)(n-tate); yokocheck[P[i].second.first]=true; } } ll sum = 0; for(int i=1; i