#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
const int B = 20;
int n;
int p[N], l[N], to[N], nxt[N], cst[N];
int mx[3 * N], sp[N][B], py[N][B];
void build(int tl = 0, int tr = n - 1, int td = 1) {
  if (tl == tr)
    mx[td] = tl;
  else {
    int tm = (tl + tr) >> 1;
    build(tl, tm, td + td);
    build(tm + 1, tr, td + td + 1);
    if (to[mx[td + td]] > to[mx[td + td + 1]])
      mx[td] = mx[td + td];
    else
      mx[td] = mx[td + td + 1];
  }
}
int get(int l, int r, int tl = 0, int tr = n - 1, int td = 1) {
  if (l > tr || tl > r)
    return -1;
  else if (l <= tl && tr <= r)
    return mx[td];
  else {
    int tm = (tl + tr) >> 1;
    int a = get(l, r, tl, tm, td + td);
    int b = get(l, r, tm + 1, tr, td + td + 1);
    if (a == -1) return b;
    if (b == -1) return a;
    return (to[a] > to[b] ? a : b);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> p[i] >> l[i];
    to[i] = p[i] + l[i];
  }
  build();
  for (int i = 0; i < n; i++) {
    int j = lower_bound(p, p + n, p[i] + l[i] + 1) - p - 1;
    if (j == i) {
      nxt[i] = i + 1;
      cst[i] = p[i + 1] - p[i] - l[i];
    } else {
      nxt[i] = get(i + 1, j);
      cst[i] = 0;
      if (to[nxt[i]] < to[i] && j < n - 1) {
        nxt[i] = j + 1;
        cst[i] = p[nxt[i]] - p[i] - l[i];
      }
    }
  }
  nxt[n - 1] = n - 1;
  cst[n - 1] = 0;
  for (int i = 0; i < n; i++) {
    sp[i][0] = nxt[i];
    py[i][0] = cst[i];
  }
  for (int j = 1; j < B; j++) {
    for (int i = 0; i < n; i++) {
      sp[i][j] = sp[sp[i][j - 1]][j - 1];
      py[i][j] = py[i][j - 1] + py[sp[i][j - 1]][j - 1];
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int x, y;
    cin >> x >> y;
    int ans = 0;
    x--;
    y--;
    for (int i = B - 1; i >= 0; i--) {
      if (sp[x][i] < y) {
        ans += py[x][i];
        x = sp[x][i];
      }
    }
    if (to[x] < p[y]) {
      ans += cst[x];
    }
    cout << ans << endl;
  }
  return 0;
}
