#include<bits/stdc++.h>
#define fr first
#define sc second
#define pb push_back
#define ll long long
#define maxheap priority_queue<int>
#define minheap priority_queue<int,vector<int>,greater<int>>
#define all(v) (v).begin(),(v).end()
const  double pi = acos(-1.0);
const  double eps = 1e-12;
using namespace std;

const int N = 1e8 + 10;
int a[N][2];
ll sum(unordered_map<int, ll> &t, int i, int id) {
  ll res = 0;
  for (; i >= 0; i -= (i + 1) & -(i + 1))
    if (t.count(i)) res += t[i];
  return res;
}
void inc(unordered_map<int, ll> &t, int i, int value, int id) {
    for (; i < N; i += (i + 1) & -(i + 1))
        t[i] += value;
}

ll sum (unordered_map<int, ll> &t, int l, int r, int id){
	ll res =  0;
    if (r > 0) res = sum (t, r, id);
    if (l - 1 >= 0) res -= sum (t, l - 1, id);
    return res;
}
int n, m, q;

void solve(){ 
  
    unordered_map <int, ll> t[4];
    cin >> n >> m >> q;
    inc(t[0], 0, n, 0);
    inc(t[1], 0, m, 1);
    ll ans = 0;
    
    while (q--){
        int type, x, y;
        cin >> type >> x >> y;
        type--;
        inc(t[type], a[x][type], -1, type);
        inc(t[type], y, 1, type);
        inc(t[type + 2], a[x][type], -a[x][type], type + 2);
        inc(t[type + 2], y, y, type + 2);
        
        ll prefSumx = sum(t[type ^ 1], 0, a[x][type], type ^ 1);
        ll prefSumy = sum(t[type ^ 1], 0, y, type ^ 1);
        ll delta = sum(t[(type + 2) ^ 1], a[x][type] + 1, y, (type + 2) ^ 1);
        ans -= prefSumx * a[x][type];
        ans += prefSumy * y;
        ans -= delta;
        a[x][type] = y;
        //cout << ans << " " << prefSumx << " " << prefSumy << " " << delta << endl;
        cout << ans << "\n";
    }
    //cout << ans << endl;
    
    
} 


int main(){
    ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
    cout.setf(ios::fixed), cout.precision(6);
    //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout);
    //freopen("exercise.in","r",stdin); freopen("exercise.out", "w", stdout);
    int step;
    step = 1;
    //cin >> step;
    for (int i = 1; i <= step; i++){
        solve(); 
    }
}
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

int main() {
    int n,x;
    string s;
    cin>>n>>x>>s;

    int ans=x;
    rep(i,n){
        if(s[i]=='o') ans++;
        else{
            if(ans>0) ans--;
        }
    }   

    cout<<ans<<endl;

}