#include <bits/stdc++.h>
using namespace std;
int n, p[200005], l[200005], BIT[200005];
int f[200005][18], nxt[200005][18];
int query(int x) {
  int res = 0;
  while (x) res = ((res) > (BIT[x]) ? (res) : (BIT[x])), x -= x & -x;
  return res;
}
void update(int x, int val) {
  while (x <= n) BIT[x] = ((BIT[x]) > (val) ? (BIT[x]) : (val)), x += x & -x;
}
void input() {
  int i, rightmost, j, x, y, nq, res;
  scanf("%d", &n);
  for ((i) = (1); (i) <= (n); (i)++) scanf("%d %d", &p[i], &l[i]);
  for ((i) = (n); (i) >= (1); (i)--) {
    rightmost =
        ((p[i] + l[i]) >
                 (query(upper_bound(p + 1, p + n + 1, p[i] + l[i]) - p - 1))
             ? (p[i] + l[i])
             : (query(upper_bound(p + 1, p + n + 1, p[i] + l[i]) - p - 1)));
    nxt[i][0] = upper_bound(p + 1, p + n + 1, rightmost) - p;
    f[i][0] =
        ((p[nxt[i][0]] - rightmost) > (0) ? (p[nxt[i][0]] - rightmost) : (0));
    update(i, rightmost);
  }
  nxt[n + 1][0] = n + 1;
  for (j = 1; j < 18; j++) {
    nxt[n + 1][j] = n + 1;
    for ((i) = (1); (i) <= (n); (i)++) {
      nxt[i][j] = nxt[nxt[i][j - 1]][j - 1];
      f[i][j] = f[i][j - 1] + f[nxt[i][j - 1]][j - 1];
    }
  }
  scanf("%d", &nq);
  while (nq--) {
    scanf("%d %d", &x, &y);
    res = 0;
    for ((j) = (18 - 1); (j) >= 0; (j)--)
      if (nxt[x][j] <= y) {
        res += f[x][j];
        x = nxt[x][j];
      }
    printf("%d\n", res);
  }
}
int main() {
  input();
  return 0;
}
