/**
 * Author: Sergey Kopeliovich (Burunduk30@gmail.com)
 * Date: 2012.02.22
 */

#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()

typedef vector <int> vi;

const int maxN = (int)2e5;
const int SIZE = 3000;

int bn, n, m, res, x[maxN], y[maxN], p[maxN], px[maxN];
vi v[2 * maxN];

inline bool xless( int i, int j ) { return x[i] < x[j]; }

void Build() {
  bn = n;
  forn(i, n)
    p[i] = i;
  sort(p, p + n, xless);
  forn(i, n)
    px[i] = x[p[i]], v[n + i] = vi(1, y[p[i]]);
  for (int i = n - 1; i >= 1; i--) {
    v[i].resize(sz(v[2 * i]) + sz(v[2 * i + 1]));
    merge(all(v[2 * i]), all(v[2 * i + 1]), v[i].begin());
  }
}

int get( vi &v, int ly, int ry ) {
  return upper_bound(all(v), ry) - lower_bound(all(v), ly);
}

int main() {
  #define NAME "countonline"
  assert(freopen(NAME ".in", "r", stdin));
  assert(freopen(NAME ".out", "w", stdout));

  scanf("%d", &n);
  forn(i, n)
    scanf("%d%d", &x[i], &y[i]);
  scanf("%d", &m);
  Build();
  while (m--) {
    char type;
    scanf(" %c", &type);
    if (type == '?') {
      int lx, ly, rx, ry;
      scanf("%d%d%d%d", &lx, &ly, &rx, &ry);
      res = 0;
      for (int i = bn; i < n; i++)
        res += (lx <= x[i] && x[i] <= rx && ly <= y[i] && y[i] <= ry);

      int l = lower_bound(px, px + bn, lx) - px;
      int r = upper_bound(px, px + bn, rx) - px - 1;
      for (l += bn, r += bn; l <= r; l /= 2, r /= 2) {
        if (l % 2 == 1) res += get(v[l++], ly, ry);
        if (r % 2 == 0) res += get(v[r--], ly, ry);
      }
      printf("%d\n", res);
    } else {
      scanf("%d%d", &x[n], &y[n]);
      x[n] += res % 100, y[n] += res % 101;
      n++;
      if (n - bn > SIZE)
        Build();
    }
  }
  return 0;
}
