#include <bits/stdc++.h>
using namespace std;
struct pInfo {
  int idx;
  long long reach;
  pInfo(int i, long long r) { idx = i, reach = r; };
};
long long n, pos[200005], len[200005], R[200005], U[200005][19], S[200005][19],
    q, a, b;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  while (cin >> n) {
    memset(R, -1, sizeof R);
    memset(U, -1, sizeof U);
    for (int i = 0; i < n; ++i) cin >> pos[i] >> len[i];
    pos[n] = 9990000000LL;
    stack<pInfo> st;
    st.push(pInfo(n, 9990000000LL));
    for (int i = n - 1; i >= 0; --i) {
      long long lim = pos[i] + len[i], reach = lim;
      while (pos[st.top().idx] <= lim) {
        reach = max(reach, st.top().reach);
        st.pop();
      }
      R[i] = reach;
      U[i][0] = st.top().idx;
      S[i][0] = max(pos[U[i][0]] - reach, 0LL);
      st.push(pInfo(i, reach));
    }
    for (int j = 1; j < 19; ++j) {
      for (int i = 0; i < n; ++i) {
        if (U[i][j - 1] == -1) continue;
        U[i][j] = U[U[i][j - 1]][j - 1];
        S[i][j] = S[i][j - 1] + S[U[i][j - 1]][j - 1];
      }
    }
    cin >> q;
    while (q--) {
      cin >> a >> b;
      --a;
      --b;
      long long res = 0;
      while (a >= 0 && a <= b) {
        int jmp = 0;
        while (U[a][jmp] >= 0 && U[a][jmp] <= b) jmp++;
        if (!jmp) break;
        res += S[a][jmp - 1];
        a = U[a][jmp - 1];
      }
      cout << res << '\n';
    }
  }
  return 0;
}
