#include <bits/stdc++.h>
using namespace std;
const int n_max = 200010;
int A[n_max], B[n_max], T[n_max * 5], P[n_max][20], W[n_max][20];
int n;
void modify(int u, int v, int x = 1, int l = 1, int r = n) {
  if (l == r) {
    T[x] = v;
    return;
  }
  int k = x << 1, mid = (l + r) >> 1;
  if (u <= mid)
    modify(u, v, k, l, mid);
  else
    modify(u, v, k + 1, mid + 1, r);
  T[x] = max(T[k], T[k + 1]);
}
int get_max(int u, int v, int x = 1, int l = 1, int r = n) {
  if (v < l || r < u) return 0;
  if (u <= l && r <= v) return T[x];
  int k = x << 1, mid = (l + r) >> 1;
  return max(get_max(u, v, k, l, mid), get_max(u, v, k + 1, mid + 1, r));
}
void enter() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> A[i] >> B[i];
}
void init() {
  int i, j, k;
  for (i = n; i; --i) {
    j = upper_bound(A + 1, A + n + 1, A[i] + B[i]) - A;
    k = max(A[i] + B[i], get_max(i, j - 1));
    P[i][0] = upper_bound(A + 1, A + n + 1, k) - A;
    if (P[i][0] <= n) W[i][0] = A[P[i][0]] - k;
    modify(i, k);
  }
  for (j = 1; j < 20; ++j)
    for (i = 1; i <= n; ++i) {
      k = P[i][j - 1];
      if (k > n) continue;
      P[i][j] = P[k][j - 1];
      W[i][j] = W[i][j - 1] + W[k][j - 1];
    }
}
void solve() {
  int q, x, y, i, s;
  cin >> q;
  while (q--) {
    cin >> x >> y;
    s = 0;
    for (i = 19; i >= 0; --i)
      if (P[x][i] && P[x][i] <= y) s += W[x][i], x = P[x][i];
    cout << s << "\n";
  }
}
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(nullptr);
  enter();
  init();
  solve();
  return 0;
}
