#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T x, T y) {
  if (x > y) swap(x, y);
  while (x != 0) {
    T r = y % x;
    y = x;
    x = r;
  }
  return y;
}
template <class T>
int bit(T s) {
  return __builtin_popcountll(s);
}
const int esp = (int)(1e9);
const double pi = acos(-1);
const int base = 1;
const int Nmax = 200100;
int n, Q, result[Nmax], tmin[8 * Nmax], vmin[8 * Nmax], l[Nmax], r[Nmax],
    t[8 * Nmax], tmp[8 * Nmax], a[2 * Nmax], cnt, X[2 * Nmax], Y[Nmax];
vector<int> q[Nmax];
void up(int i) {
  tmin[i] = min(tmin[i * 2], tmin[i * 2 + 1]);
  if (tmin[i * 2] == tmin[i])
    vmin[i] = vmin[i * 2];
  else
    vmin[i] = vmin[i * 2 + 1];
  t[i] = t[i * 2] + t[i * 2 + 1];
}
void initial(int i, int lo, int hi) {
  tmp[i] = 0;
  if (lo == hi) {
    tmin[i] = a[lo];
    vmin[i] = lo;
    if (a[lo] == 0)
      t[i] = X[lo] - X[lo - 1];
    else
      t[i] = 0;
    return;
  }
  int mid = (lo + hi) / 2;
  initial(i * 2, lo, mid);
  initial(i * 2 + 1, mid + 1, hi);
  up(i);
}
void flow(int i) {
  for (int j = 0; j <= 1; j++) {
    int u = i * 2 + j;
    tmp[u] += tmp[i];
    tmin[u] -= tmp[i];
  }
  tmp[i] = 0;
}
void update(int i, int lo, int hi, int u, int v, int x) {
  if (u > hi || v < lo) return;
  if (u <= lo && hi <= v) {
    tmin[i] -= x;
    tmp[i] += x;
    return;
  }
  if (tmp[i] != 0) flow(i);
  int mid = (lo + hi) / 2;
  update(i * 2, lo, mid, u, v, x);
  update(i * 2 + 1, mid + 1, hi, u, v, x);
  up(i);
}
void change(int i, int lo, int hi, int u) {
  if (lo == hi) {
    t[i] = X[lo] - X[lo - 1];
    tmin[i] = n + 1;
    return;
  }
  if (tmp[i] != 0) flow(i);
  int mid = (lo + hi) / 2;
  if (u <= mid)
    change(i * 2, lo, mid, u);
  else
    change(i * 2 + 1, mid + 1, hi, u);
  up(i);
}
pair<int, int> getmin(int i, int lo, int hi, int u, int v) {
  if (u > hi || v < lo) return make_pair(cnt + 1, 0);
  if (u <= lo && hi <= v) return make_pair(tmin[i], vmin[i]);
  if (tmp[i] != 0) flow(i);
  int mid = (lo + hi) / 2;
  pair<int, int> L = getmin(i * 2, lo, mid, u, v),
                 R = getmin(i * 2 + 1, mid + 1, hi, u, v);
  if (L.first < R.first)
    return L;
  else
    return R;
}
int get(int i, int lo, int hi, int u, int v) {
  if (u > hi || v < lo) return 0;
  if (u <= lo && hi <= v) return t[i];
  if (tmp[i] != 0) flow(i);
  int mid = (lo + hi) / 2;
  return get(i * 2, lo, mid, u, v) + get(i * 2 + 1, mid + 1, hi, u, v);
}
void init() {
  cnt = 0;
  for (int i = 1; i <= n; i++) {
    X[cnt++] = l[i];
    X[cnt++] = r[i];
  }
  sort(X, X + cnt);
  int cnt2 = 0;
  for (int i = 0; i <= cnt - 1; i++)
    if (i == 0 || X[i] != X[i - 1]) X[cnt2++] = X[i];
  cnt = cnt2;
  for (int i = 1; i <= n; i++) {
    l[i] = (lower_bound(X, X + cnt, l[i]) - X) + 1;
    r[i] = (lower_bound(X, X + cnt, r[i]) - X);
    a[l[i]]++;
    a[r[i] + 1]--;
  }
  cnt--;
  a[0] = 0;
  for (int i = 1; i <= cnt; i++) {
    a[i] += a[i - 1];
  }
  initial(1, 1, cnt);
}
void solve() {
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= (int)q[i].size() - 1; j++) {
      int u = l[i], v = Y[q[i][j]];
      if (u > v)
        result[q[i][j]] = 0;
      else
        result[q[i][j]] = get(1, 1, cnt, u, v);
    }
    update(1, 1, cnt, l[i], r[i], 1);
    pair<int, int> x = getmin(1, 1, cnt, l[i], r[i]);
    while (x.first == 0) {
      change(1, 1, cnt, x.second);
      x = getmin(1, 1, cnt, l[i], r[i]);
    }
  }
  for (int i = 1; i <= Q; i++) cout << result[i] << endl;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    r[i] += l[i];
  }
  init();
  cin >> Q;
  for (int i = 1; i <= Q; i++) {
    int x;
    cin >> x >> Y[i];
    Y[i] = l[Y[i]] - 1;
    q[x].push_back(i);
  }
  solve();
  return 0;
}
