#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200200;
const int LOGN = 18;
int P[MAXN], L[MAXN], n;
int R[MAXN], U[LOGN][MAXN], C[LOGN][MAXN];
struct Fenwick {
  static const int sz = 1000001;
  int t[sz];
  void adjust(int p, int v) {
    for (; p < sz; p += (p & -p)) t[p] = max(t[p], v);
  }
  int get(int p) {
    int s = 0;
    for (; p; p -= (p & -p)) s = max(s, t[p]);
    return s;
  }
} f;
int main() {
  while (cin >> n) {
    memset(f.t, 0, sizeof(f.t));
    for (int i = (0); i < (n); i++) cin >> P[i] >> L[i];
    for (int i = n - 1; i >= 0; i--) {
      R[i] = max(P[i] + L[i], f.get(upper_bound(P, P + n, P[i] + L[i]) - P));
      f.adjust(i + 1, R[i]);
      U[0][i] = upper_bound(P, P + n, R[i]) - P;
      C[0][i] = max(0, P[U[0][i]] - R[i]);
    }
    for (int k = (0); k < (LOGN); k++) U[k][n] = n;
    for (int k = 1; k < LOGN; k++) {
      for (int i = (0); i < (n); i++) {
        C[k][i] = C[k - 1][i] + C[k - 1][U[k - 1][i]];
        U[k][i] = U[k - 1][U[k - 1][i]];
      }
    }
    int q;
    cin >> q;
    while (q--) {
      int i, j;
      cin >> i >> j;
      i--, j--;
      int r = 0;
      for (int k = LOGN - 1; k >= 0; k--) {
        if (U[k][i] <= j) {
          r += C[k][i];
          i = U[k][i];
        }
      }
      cout << r << endl;
    }
  }
  return 0;
}
