#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e6;
const int inf = (1ll << 31) - 1;
int p[maxn], l[maxn];
int n;
pair<pair<int, int>, int> e[maxn];
pair<int, int> st[maxn];
int sum[maxn], answer[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &p[i], &l[i]);
  }
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; ++i) {
    int l, r;
    scanf("%d%d", &l, &r);
    l--;
    r--;
    e[i] = make_pair(make_pair(l, r), i);
  }
  sort(e, e + m);
  reverse(e, e + m);
  int ei = 0, stn = 0;
  for (int i = n - 1; i >= 0; --i) {
    int end = p[i] + l[i];
    while (stn > 0 && st[stn - 1].first <= p[i] + l[i]) {
      end = max(end, st[stn - 1].second);
      --stn;
    }
    st[stn++] = make_pair(p[i], end);
    sum[stn - 1] = 0;
    if (stn > 1) sum[stn - 1] += sum[stn - 2] + st[stn - 2].first - end;
    while (ei < m && e[ei].first.first == i) {
      int pos = lower_bound(st, st + stn, make_pair(p[e[ei].first.second], inf),
                            greater<pair<int, int> >()) -
                st;
      answer[e[ei].second] = sum[stn - 1] - sum[pos];
      ei++;
    }
  }
  for (int i = 0; i < m; ++i) printf("%d\n", answer[i]);
  return 0;
}
