#include <bits/stdc++.h>
using namespace std;
template <class P, class Q>
inline void smin(P &a, Q b) {
  if (b < a) a = b;
}
template <class P, class Q>
inline void smax(P &a, Q b) {
  if (a < b) a = b;
}
const int maxn = 200000 + 100;
int n, qt;
int a[maxn], b[maxn];
int store[2 * maxn], len[2 * maxn], k;
pair<pair<int, int>, int> q[maxn];
set<int> s;
int fen[2 * maxn];
int ans[maxn];
inline void add(int x, int val) {
  for (x++; x < 2 * maxn; x += x & -x) fen[x] += val;
}
inline int get(int x) {
  int res = 0;
  for (; x; x -= x & -x) res += fen[x];
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0, _n = (int)(n); i < _n; i++) cin >> a[i] >> b[i], b[i] += a[i];
  cin >> qt;
  for (int i = 0, _n = (int)(qt); i < _n; i++)
    cin >> q[i].first.first >> q[i].first.second, q[i].first.first--,
        q[i].first.second--, q[i].second = i;
  for (int i = 0, _n = (int)(n); i < _n; i++)
    store[k++] = a[i], store[k++] = b[i];
  sort(store, store + k);
  k = unique(store, store + k) - store;
  for (int i = 0, _n = (int)(k - 1); i < _n; i++)
    len[i] = store[i + 1] - store[i], add(i, len[i]), s.insert(i);
  sort(q, q + qt);
  reverse(q, q + qt);
  int pos = n;
  for (int i = 0, _n = (int)(qt); i < _n; i++) {
    while (pos > q[i].first.first) {
      pos--;
      int aa = lower_bound(store, store + k, a[pos]) - store;
      int bb = lower_bound(store, store + k, b[pos]) - store;
      int bef = get(aa);
      while (bef != get(bb)) {
        int x = *s.lower_bound(aa);
        s.erase(x);
        add(x, -len[x]);
      }
    }
    int l = lower_bound(store, store + k, a[q[i].first.first]) - store;
    int r = lower_bound(store, store + k, a[q[i].first.second]) - store;
    ans[q[i].second] = get(r) - get(l);
  }
  for (int i = 0, _n = (int)(qt); i < _n; i++) cout << ans[i] << endl;
  return 0;
}
