#include <bits/stdc++.h>
const int maxn = 1e5 + 7;
int c1, flag, n, cnt;
long long ans, a, b, c;
void answer() {
  if (c1)
    puts("1");
  else if (ans)
    puts("2");
  else if (flag)
    puts("3");
  else
    puts("0");
}
__int128 abs(__int128 x) { return x < 0 ? -x : x; }
struct fraction {
  __int128 u, d;
} xi, yi, x[maxn], y[maxn];
fraction rev(fraction f) {
  f.u = -f.u;
  f.d = -f.d;
  return f;
}
__int128 gcd(__int128 a, __int128 b) { return b == 0 ? a : gcd(b, a % b); }
fraction adj(fraction f) {
  __int128 g = gcd(abs(f.u), abs(f.d));
  f.u /= g;
  f.d /= g;
  return f;
}
bool cross(fraction a, fraction b) {
  return (__int128)a.u * b.d > (__int128)a.d * b.u;
}
int Q(fraction a) {
  if (a.u > 0 && a.d >= 0) return 1;
  if (a.u <= 0 && a.d > 0) return 2;
  if (a.u < 0 && a.d <= 0) return 3;
  if (a.u >= 0 && a.d < 0) return 4;
}
fraction frac(int x, int y) {
  fraction f;
  f.u = x;
  f.d = y;
  return adj(f);
}
fraction frac(long long x, long long y) {
  fraction f;
  f.u = x;
  f.d = y;
  return adj(f);
}
fraction operator-(fraction a, fraction b) {
  __int128 g1 = b.d, g2 = a.d;
  a.u *= g1;
  a.d *= g1;
  b.u *= g2;
  b.d *= g2;
  assert(a.d == b.d);
  a.u -= b.u;
  return adj(a);
}
bool operator<(fraction a, fraction b) {
  if (Q(a) != Q(b)) return Q(a) < Q(b);
  return cross(a, b);
}
bool operator==(fraction a, fraction b) { return a.u == b.u && a.d == b.d; }
fraction operator/(fraction a, fraction b) {
  a.u *= b.d;
  a.d *= b.u;
  return adj(a);
}
fraction get_slope(fraction x1, fraction y1, fraction x2, fraction y2) {
  return adj(adj(y2 - y1) / adj(x2 - x1));
}
void print(fraction f) { printf("(%lld %lld)\n", f.u, f.d); }
std::multiset<fraction> S3;
std::map<fraction, int> W;
char opt[10];
int main() {
  scanf("%lld%lld%lld%d", &a, &b, &c, &n);
  xi = frac(b, a + b + c);
  yi = frac(c, a + b + c);
  while (n--) {
    scanf("%s", opt + 1);
    if (opt[1] == 'A') {
      scanf("%lld%lld%lld", &a, &b, &c);
      x[++cnt] = frac(b, a + b + c);
      y[cnt] = frac(c, a + b + c);
      if (x[cnt] == xi && y[cnt] == yi) {
        c1++;
        answer();
        continue;
      }
      auto F = get_slope(x[cnt], y[cnt], xi, yi);
      ans += W[rev(F)];
      if (S3.size() > 1 && !flag) {
        auto pr = S3.lower_bound(F);
        if (pr == S3.end()) pr = S3.begin();
        std::multiset<fraction>::iterator pl = pr;
        if (pl == S3.begin()) pl = S3.end();
        pl--;
        if (!cross(*pl, *pr) && cross(*pl, F) && cross(F, *pr)) flag = 1;
      }
      S3.insert(F);
      W[F]++;
    } else {
      scanf("%d", &c);
      if (x[c] == xi && y[c] == yi) {
        c1--;
        answer();
        continue;
      }
      auto F = get_slope(x[c], y[c], xi, yi);
      S3.erase(S3.find(F));
      W[F]--;
      ans -= W[rev(F)];
      if (flag) {
        auto pr = S3.lower_bound(F);
        if (pr == S3.end()) pr = S3.begin();
        std::multiset<fraction>::iterator pl = pr;
        if (pl == S3.begin()) pl = S3.end();
        pl--;
        if (!cross(*pl, *pr)) flag = 0;
      }
    }
    answer();
  }
  return 0;
}
