/**
 * 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 = 1 << 18;
const int SIZE = 3000;

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

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

void Allocate() {
  forn(i, maxN)
    v[i + maxN].resize(1);
  for (int i = maxN - 1; i > 0; i--)
    v[i].resize(sz(v[2 * i]) + sz(v[2 * i + 1]));
}

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

int get( vi &v, int s, int ly, int ry ) {
  #define ALL v.begin(), v.begin() + s
  assert(sz(v) >= s);
  return upper_bound(ALL, ry) - lower_bound(ALL, 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);
  Allocate();
  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 += maxN, r += maxN; l <= r; l /= 2, r /= 2)
      {
        if (l % 2 == 1) res += get(v[l], size[l], ly, ry), l++;
        if (r % 2 == 0) res += get(v[r], size[r], ly, ry), r--;
      }
      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;
}
