#include <bits/stdc++.h>
using namespace std;
const long double PI = acos((long double)-1.0);
const int N = 100005;
int q, n, S, P, G, bad, cnt1, cnt2;
long double F[N];
multiset<long double> ST;
map<long double, int> MP;
inline void Add(int i) {
  long double ang = F[i];
  MP[ang]++;
  if (MP[ang] > 1) return;
  if (!ST.size()) {
    ST.insert(ang);
    bad = 1;
    cnt2 = 0;
    return;
  }
  if (ST.size() == 1) {
    if (abs(abs(*ST.begin() - ang) - PI) <= ((long double)(1e-12)))
      cnt2 = 1, bad = 0;
    else
      cnt2 = 0, bad = 1;
    ST.insert(ang);
    return;
  }
  auto it = ST.upper_bound(ang);
  if (it == ST.end()) it = ST.begin();
  long double nxt = *it;
  if (nxt < ang) nxt += PI * 2.0;
  it = ST.upper_bound(ang);
  if (it == ST.begin()) it = ST.end();
  it--;
  long double prv = *it;
  if (prv > ang) prv -= PI * 2.0;
  long double df = abs(nxt - ang);
  if (df > PI + ((long double)(1e-12))) bad++;
  df = abs(ang - prv);
  if (nxt - prv > PI + ((long double)(1e-12)) && ang - prv <= PI) bad--;
  long double val = ang + PI;
  if (val >= PI) val -= PI * 2.0;
  it = ST.lower_bound(val - ((long double)(1e-12)));
  if (it != ST.end() && abs(abs(*it - ang) - PI) <= ((long double)(1e-12)))
    cnt2++;
  else {
    it = ST.lower_bound(val);
    if (it != ST.end() && abs(abs(*it - ang) - PI) <= ((long double)(1e-12)))
      cnt2++;
  }
  ST.insert(ang);
}
inline void Del(int i) {
  long double ang = F[i];
  MP[ang]--;
  if (MP[ang]) return;
  if (ST.size() == 1) {
    bad = cnt2 = 0;
    ST.clear();
    return;
  }
  int sz = (int)ST.size();
  ST.erase(ang);
  assert(sz - 1 == (int)ST.size());
  if (ST.size() == 1) {
    bad = 1;
    cnt2 = 0;
    return;
  }
  auto it = ST.upper_bound(ang);
  if (it == ST.end()) it = ST.begin();
  long double nxt = *it;
  if (nxt < ang) nxt += PI * 2.0;
  it = ST.upper_bound(ang);
  if (it == ST.begin()) it = ST.end();
  it--;
  long double prv = *it;
  if (prv > ang) prv -= PI * 2.0;
  long double df = abs(nxt - ang);
  if (df > PI + ((long double)(1e-12))) bad--;
  df = abs(ang - prv);
  if (nxt - prv > PI + ((long double)(1e-12)) && ang - prv <= PI) bad++;
  long double val = ang + PI;
  if (val >= PI) val -= PI * 2.0;
  it = ST.lower_bound(val - ((long double)(1e-12)));
  if (it != ST.end() && abs(abs(*it - ang) - PI) <= ((long double)(1e-12)))
    cnt2--;
  else {
    it = ST.lower_bound(val);
    if (it != ST.end() && abs(abs(*it - ang) - PI) <= ((long double)(1e-12)))
      cnt2--;
  }
}
inline void Adder(int i) {
  long double ang = F[i];
  MP[ang]++;
  if (MP[ang] == 1) ST.insert(ang);
  cnt2 = bad = 0;
  if (ST.size() <= 1) return;
  auto rr = ST.begin();
  for (auto it = ST.begin(); it != ST.end(); it++) {
    while (rr != ST.end() && abs(*rr - *it) < PI - ((long double)(1e-12))) rr++;
    if (rr != ST.end() && abs(abs(*rr - *it) - PI) <= ((long double)(1e-12))) {
      cnt2 = 1;
    }
    auto itr = it;
    itr++;
    assert(it != itr);
    if (itr == ST.end()) itr = ST.begin();
    long double nw = *it;
    long double nxt = *itr;
    if (nxt < nw) nxt += PI * 2.0;
    if (abs(nxt - nw) > PI + ((long double)(1e-12))) bad++;
  }
  return;
}
inline void Deler(int i) {
  long double ang = F[i];
  MP[ang]--;
  if (!MP[ang]) ST.erase(ST.lower_bound(ang));
  cnt2 = bad = 0;
  if (ST.size() <= 1) return;
  auto rr = ST.begin();
  for (auto it = ST.begin(); it != ST.end(); it++) {
    while (rr != ST.end() && abs(*rr - *it) < PI - ((long double)(1e-12))) rr++;
    if (rr != ST.end() && abs(abs(*rr - *it) - PI) <= ((long double)(1e-12))) {
      cnt2 = 1;
    }
    auto itr = it;
    itr++;
    assert(it != itr);
    if (itr == ST.end()) itr = ST.begin();
    long double nw = *it;
    long double nxt = *itr;
    if (nxt < nw) nxt += PI * 2.0;
    if (abs(nxt - nw) > PI + ((long double)(1e-12))) bad++;
  }
  return;
}
int main() {
  scanf("%d%d%d%d", &S, &P, &G, &q);
  int sub = q <= 5010;
  complex<long double> center =
      complex<long double>((long double)S / (long double)(S + P + G),
                           (long double)P / (long double)(S + P + G));
  for (; q; q--) {
    char ss[2];
    scanf("%s", &ss);
    if (ss[0] == 'A') {
      int s, p, g;
      scanf("%d%d%d", &s, &p, &g);
      complex<long double> pp =
          complex<long double>((long double)s / (long double)(s + p + g),
                               (long double)p / (long double)(s + p + g));
      pp -= center;
      if (abs(pp.real()) <= ((long double)(1e-12)) &&
          abs(pp.imag()) <= ((long double)(1e-12)))
        cnt1++, F[++n] = 1e18;
      else {
        F[++n] = arg(pp);
        if (sub)
          Adder(n);
        else
          Add(n);
      }
    } else {
      int i;
      scanf("%d", &i);
      if (F[i] == 1e18)
        cnt1--;
      else {
        if (sub)
          Deler(i);
        else
          Del(i);
      }
    }
    if (cnt1)
      printf("1\n");
    else if (ST.size() <= 1)
      printf("0\n");
    else if (ST.size() && cnt2)
      printf("2\n");
    else if (ST.size() && !bad)
      printf("3\n");
    else
      printf("0\n");
  }
  return 0;
}
