#include <bits/stdc++.h>
using namespace std;
using namespace std;
int n, q, ans, cur, l, r, tmp;
int f[444444], cover[444444], d[444444][22], w[444444][22];
int queue[444444], x[444444], y[444444];
struct node {
  int l, r, m, key, va;
} t[444444 * 2];
void build(int k, int l, int r) {
  t[k].l = l;
  t[k].r = r;
  if (l == r) return;
  build(k + k, l, (l + r) / 2);
  build(k + k + 1, (l + r) / 2 + 1, r);
}
void query(int k, int l, int r) {
  if (l > t[k].r || r < t[k].l) return;
  if (l <= t[k].l && t[k].r <= r) {
    ans = max(ans, t[k].key);
    cur = max(cur, t[k].va);
    return;
  }
  query(k * 2, l, r);
  query(k * 2 + 1, l, r);
}
void modify(int k, int x, int y, int yy) {
  if (x > t[k].r || x < t[k].l) return;
  if (t[k].l == t[k].r) {
    t[k].key = y;
    t[k].va = yy;
    return;
  }
  modify(k * 2, x, y, yy);
  modify(k * 2 + 1, x, y, yy);
  t[k].key = max(t[k * 2].key, t[k * 2 + 1].key);
  t[k].va = max(t[k * 2].va, t[k * 2 + 1].va);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &x[i], &y[i]);
  cover[n] = n;
  l = 1;
  r = 0;
  build(1, 1, n);
  cover[n] = n;
  modify(1, n, n, x[n] + y[n]);
  for (int i = n - 1; i >= 1; i--) {
    tmp = i;
    for (int j = 1 << 20; j; j >>= 1)
      if (tmp + j <= n && x[tmp + j] <= x[i] + y[i]) tmp += j;
    if (tmp == i) {
      cover[i] = i;
      f[i] = x[i] + y[i];
    } else {
      ans = cur = 0;
      query(1, i + 1, tmp);
      cover[i] = ans;
      f[i] = max(cur, x[i] + y[i]);
    }
    modify(1, i, cover[i], f[i]);
  }
  for (int i = n - 1; i >= 1; i--) {
    if (cover[i] < n) {
      d[i][0] = x[cover[i] + 1] - f[i];
      w[i][0] = cover[i] + 1;
    }
    for (int j = 1; w[i][j - 1]; ++j) {
      d[i][j] = d[w[i][j - 1]][j - 1] + d[i][j - 1];
      w[i][j] = w[w[i][j - 1]][j - 1];
    }
  }
  scanf("%d", &q);
  for (int TT = 1; TT <= q; TT++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (cover[x] >= y)
      puts("0");
    else {
      ans = 0;
      for (int j = 20; j >= 0; j--)
        if (cover[w[x][j]] && cover[w[x][j]] < y) {
          ans += d[x][j];
          x = w[x][j];
        }
      ans += d[x][0];
      printf("%d\n", ans);
    }
  }
  return 0;
}
