#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, lg = 1;
int q;
int p[N], l[N];
int nx[20][N];
int sum[20][N];
int mx[(1 << 19) + 5];
void upd(int pos, int value) {
  pos += lg - 1;
  mx[pos] = value;
  while (pos > 1) {
    pos >>= 1;
    mx[pos] = max(mx[pos + pos], mx[pos + pos + 1]);
  }
}
int GetMax(int pos) {
  int res = 0;
  int l = 1, r = pos;
  l += lg - 1;
  r += lg - 1;
  while (l < r) {
    if (l & 1) res = max(res, mx[l++]);
    if (!(r & 1)) res = max(res, mx[r--]);
    l >>= 1;
    r >>= 1;
  }
  if (l == r) res = max(res, mx[l]);
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  while (lg < n) lg += lg;
  for (int i = 1; i <= n; ++i) cin >> p[i] >> l[i];
  for (int i = 0; i <= 18; ++i) nx[i][n + 1] = n + 1;
  for (int i = n; i >= 1; --i) {
    int MxPos = max(p[i] + l[i],
                    GetMax(upper_bound(p + 1, p + n + 1, p[i] + l[i]) - p - 1));
    nx[0][i] = upper_bound(p + 1, p + n + 1, MxPos) - p;
    sum[0][i] = max(0, p[nx[0][i]] - MxPos);
    upd(i, MxPos);
    for (int j = 1; j <= 18; ++j) {
      nx[j][i] = nx[j - 1][nx[j - 1][i]];
      sum[j][i] = sum[j - 1][i] + sum[j - 1][nx[j - 1][i]];
    }
  }
  cin >> q;
  while (q--) {
    int res = 0;
    int x, y;
    cin >> x >> y;
    for (int i = 18; i >= 0; --i) {
      if (nx[i][x] <= y) {
        res += sum[i][x];
        x = nx[i][x];
      }
    }
    cout << res << endl;
  }
  return 0;
}
