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

#include <cassert>
#include <ctime>
#include <cstdio>
#include <algorithm>

using namespace std;

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

const int maxN = 1 << 18;
const int SIZE = 3000;

typedef vector <int> vi;

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) {
    v[maxN + i].resize(1);
    px[i] = x[p[i]];
    v[maxN + i][0] = y[p[i]];
  }
  for (int i = maxN - 1; i >= 1; i--) {
    v[i].resize(v[2 * i].size() + v[2 * i + 1].size());
    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);
}

inline int readChar();
template <class T = int> inline T readInt(); 
template <class T> inline void writeInt( T x );
inline void writeChar( int x ); 
inline void flush();

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

  n = readInt();
  forn(i, n) {
    x[i] = readInt();
    y[i] = readInt();
  }
  m = readInt();
  Build();
  while (m--) {
    char type = readChar();
    if (type == '?') {
      int lx = readInt();
      int ly = readInt();
      int rx = readInt();
      int ry = readInt();
      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], ly, ry), l++;
        if (r % 2 == 0) res += get(v[r], ly, ry), r--;
      }
      writeInt(res), writeChar('\n');
    } else {
      x[n] = readInt();
      y[n] = readInt();
      x[n] += res % 100, y[n] += res % 101;
      n++;
      if (n - bn > SIZE)
        Build();
    }
  }
  flush();
  fprintf(stderr, "Total time = %.2f\n", 1. * clock() / CLOCKS_PER_SEC);
  return 0;
}

/** Read */

static const int buf_size = 4096;

inline int getChar() {
  static char buf[buf_size];
  static int len = 0, pos = 0;
  if (pos == len)
    pos = 0, len = fread(buf, 1, buf_size, stdin);
  if (pos == len)
    return -1;
  return buf[pos++];
}

inline int readChar() {
  int c = getChar();
  while (c <= 32)
    c = getChar();
  return c;
}

template <class T>
inline T readInt() {
  int s = 1, c = readChar();
  T x = 0;
  if (c == '-')
    s = -1, c = getChar();
  while ('0' <= c && c <= '9')
    x = x * 10 + c - '0', c = getChar();
  return s == 1 ? x : -x;
}

/** Write */

static int write_pos = 0;
static char write_buf[buf_size];

inline void writeChar( int x ) {
  if (write_pos == buf_size)
    fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
  write_buf[write_pos++] = x;
}

inline void flush() {
  if (write_pos)
    fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
}

template <class T> 
inline void writeInt( T x ) {
  if (x < 0)
    writeChar('-'), x = -x;

  char s[24];
  int n = 0;
  while (x || !n)
    s[n++] = '0' + x % 10, x /= 10;
  while (n--)
    writeChar(s[n]);
}