#include <bits/stdc++.h>
using namespace std;
long long pos[200500];
long long len[200500];
set<pair<long long, long long> > st;
long long to[200500][20];
long long need[200500][20];
int n;
long long R[200500];
long long t[804000];
void update(int v, int tl, int tr, int pos, long long nv) {
  if (tl == tr) {
    t[v] = nv;
  } else {
    int tm = (tr + tl) >> 1;
    if (pos <= tm) {
      update(v << 1, tl, tm, pos, nv);
    } else
      update((v << 1) + 1, tm + 1, tr, pos, nv);
    t[v] = max(t[v << 1], t[(v << 1) + 1]);
  }
}
long long query(int v, int tl, int tr, int ql, int qr) {
  if (ql > qr) return -1;
  if (tl == ql && tr == qr) {
    return t[v];
  } else {
    int tm = (tl + tr) >> 1;
    return max(query(v << 1, tl, tm, ql, min(qr, tm)),
               query((v << 1) + 1, tm + 1, tr, max(ql, tm + 1), qr));
  }
}
int main() {
  for (int i = 0; i <= 800000; i++) t[i] = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> pos[i] >> len[i];
    st.insert(make_pair(pos[i], i));
  }
  R[n] = pos[n] + len[n];
  update(1, 1, n, n, pos[n] + len[n]);
  for (int i = n - 1; i >= 1; i--) {
    int l = i + 1;
    int r;
    auto tmp = st.lower_bound(make_pair(pos[i] + len[i] + 1, -1));
    if (tmp == st.end())
      r = n;
    else {
      r = tmp->second - 1;
    }
    R[i] = max(len[i] + pos[i], query(1, 1, n, l, r));
    update(1, 1, n, i, R[i]);
  }
  for (int i = 0; i < 20; i++) {
    to[n + 1][i] = n + 1;
    need[n + 1][i] = 0;
  }
  to[n][0] = n;
  need[n][0] = 0;
  for (int i = 0; i < 20; i++) {
    to[n][i] = n;
    need[n][i] = 0;
  }
  for (int i = n - 1; i >= 1; i--) {
    if (len[i] + pos[i] >= pos[i + 1]) {
      auto tmp = st.lower_bound(make_pair(R[i] + 1, -1));
      if (tmp == st.end()) {
        need[i][0] = 0;
        to[i][0] = n + 1;
        continue;
      }
      need[i][0] = pos[tmp->second] - R[i];
      to[i][0] = tmp->second;
    } else {
      to[i][0] = i + 1;
      need[i][0] = pos[i + 1] - pos[i] - len[i];
    }
  }
  for (int i = 1; i < 20; i++) {
    for (int j = 1; j < n; j++) {
      need[j][i] = need[j][i - 1] + need[to[j][i - 1]][i - 1];
      to[j][i] = to[to[j][i - 1]][i - 1];
    }
  }
  int q;
  cin >> q;
  for (int i = 1; i <= q; i++) {
    long long l, r;
    cin >> l >> r;
    long long curr = l;
    long long ans = 0;
    if (R[l] >= pos[r]) {
      cout << "0\n";
      continue;
    }
    for (int j = 19; j >= 0; j--) {
      if (to[curr][j] < r) {
        ans += need[curr][j];
        curr = to[curr][j];
      }
    }
    if (R[curr] < pos[r]) ans += need[curr][0];
    cout << ans << "\n";
  }
  return 0;
}
