#include <bits/stdc++.h>
using namespace std;
long long f[200001];
int st[4 * 200001], st2[4 * 200001], x[200001], h[200001], rmq[200001][21], n,
    i, q, L, R, cnt, vt, j, lg;
void update(int id, int l, int r, int u, int k) {
  if (u < l || u > r) return;
  if (l == r) {
    st[id] = k;
    return;
  }
  int mid = (l + r) >> 1;
  update(id * 2, l, mid, u, k);
  update(id * 2 + 1, mid + 1, r, u, k);
  st[id] = max(st[id * 2], st[id * 2 + 1]);
}
int get(int id, int l, int r, int u, int v) {
  if (u > r || v < l) return 0;
  if (u <= l && r <= v) return st[id];
  int mid = (l + r) >> 1;
  return max(get(id * 2, l, mid, u, v), get(id * 2 + 1, mid + 1, r, u, v));
}
void update2(int id, int l, int r, int u, int k) {
  if (u < l || u > r) return;
  if (l == r) {
    st2[id] = k;
    return;
  }
  int mid = (l + r) >> 1;
  update2(id * 2, l, mid, u, k);
  update2(id * 2 + 1, mid + 1, r, u, k);
  st2[id] = max(st2[id * 2], st2[id * 2 + 1]);
}
int get2(int id, int l, int r, int u, int v) {
  if (u > r || v < l) return 0;
  if (u <= l && r <= v) return st2[id];
  int mid = (l + r) >> 1;
  return max(get2(id * 2, l, mid, u, v), get2(id * 2 + 1, mid + 1, r, u, v));
}
void QHD() {
  cnt = 0;
  f[n] = 0;
  update(1, 1, n, n, n);
  update2(1, 1, n, n, x[n] + h[n]);
  for (i = n - 1; i >= 1; i--) {
    update2(1, 1, n, i, x[i] + h[i]);
    if (x[i] + h[i] < x[i + 1])
      vt = i;
    else {
      int l = i + 1, r = n;
      while (l < r) {
        int mid = (l + r + 1) >> 1;
        if (x[i] + h[i] >= x[mid])
          l = mid;
        else
          r = mid - 1;
      }
      vt = get(1, 1, n, i + 1, l);
    }
    if (vt == n)
      f[i] = 0;
    else {
      f[i] = f[vt + 1] + x[vt + 1] - get2(1, 1, n, i, vt);
      rmq[i][0] = vt + 1;
      for (j = 1; (1 << j) <= n; j++) rmq[i][j] = rmq[rmq[i][j - 1]][j - 1];
    }
    update(1, 1, n, i, vt);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  lg = trunc(log2(n)) + 1;
  for (i = 1; i <= n; i++) cin >> x[i] >> h[i];
  QHD();
  cin >> q;
  while (q--) {
    cin >> L >> R;
    i = L;
    for (j = lg; j >= 0; j--)
      if (rmq[i][j] > 0 && rmq[i][j] <= R) i = rmq[i][j];
    cout << f[L] - f[i] << '\n';
  }
}
