#include <bits/stdc++.h>
using namespace std;
int n, m;
int p[200005], l[200005];
vector<pair<int, int> > query;
int dp[200005][22];
int U[200005][22];
int R[200005];
int tree[200005];
void update(int i, int val) {
  for (; i <= 200005 - 5; i += i & -i) tree[i] = max(tree[i], val);
}
int get(int i) {
  int ret = 0;
  for (; i; i -= i & -i) ret = max(ret, tree[i]);
  return ret;
}
void prep() {
  R[n] = n;
  update(n, R[n]);
  for (int i = n; i >= 1; i--) {
    int t = p[i] + l[i];
    int nxt = upper_bound(p + 1, p + n + 1, t) - p - 1;
    R[i] = max(t, get(nxt));
    update(i, R[i]);
    nxt = upper_bound(p + 1, p + n + 1, R[i]) - p;
    U[i][0] = nxt;
    dp[i][0] = max(0, p[U[i][0]] - R[i]);
  }
  U[n + 1][0] = n + 1;
  for (int j = 1; j <= 19; j++) {
    U[n + 1][j] = n + 1;
    for (int i = 1; i <= n; i++) {
      U[i][j] = U[U[i][j - 1]][j - 1];
      dp[i][j] = dp[i][j - 1] + dp[U[i][j - 1]][j - 1];
    }
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> p[i] >> l[i];
  }
  prep();
  int m;
  cin >> m;
  while (m--) {
    int l, r;
    cin >> l >> r;
    int ans = 0;
    for (int i = 19; i >= 0; i--) {
      if (U[l][i] <= r) {
        ans += dp[l][i];
        l = U[l][i];
      }
      if (l == r) break;
    }
    cout << ans << '\n';
  }
}
