#include <bits/stdc++.h>
using namespace std;
int a[220000][2];
int ans[220000];
int gap[220000];
map<pair<int, int>, int> mp;
vector<pair<int, int> > quer;
vector<int> q;
vector<pair<int, int> > qq;
vector<pair<int, int> > st;
int main() {
  int i, j, k, n, x, y, qu, ma, tmp, tmp1, tmp2, tmp3, cost, ret, left, right,
      mid, now;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d%d", &a[i][0], &a[i][1]);
  q.clear();
  for (i = 0; i < n; i++) {
    ma = 0;
    while (q.size() > 0) {
      x = q[q.size() - 1];
      if (a[x][0] + a[x][1] < a[i][0]) {
        ans[x] = i - 1;
        if (a[x][0] + a[x][1] > ma) ma = a[x][0] + a[x][1];
        gap[x] = a[i][0] - ma;
        q.pop_back();
      } else
        break;
    }
    q.push_back(i);
  }
  while (q.size() > 0) {
    x = q[q.size() - 1];
    ans[x] = n - 1;
    gap[x] = 0;
    q.pop_back();
  }
  scanf("%d", &qu);
  qq.clear();
  mp.clear();
  for (i = 0; i < qu; i++) {
    scanf("%d%d", &x, &y);
    x--;
    y--;
    qq.push_back(make_pair(x, y));
  }
  quer = qq;
  sort(qq.begin(), qq.end());
  reverse(qq.begin(), qq.end());
  st.clear();
  now = n;
  for (i = 0; i < qq.size(); i++) {
    while (qq[i].first < now) {
      now--;
      tmp1 = now;
      tmp2 = ans[now];
      tmp3 = gap[now];
      while (st.size() > 0) {
        if (tmp2 >= st[st.size() - 1].first) {
          st.pop_back();
        } else
          break;
      }
      if (st.size() > 0)
        cost = st[st.size() - 1].second + tmp3;
      else
        cost = 0;
      st.push_back(make_pair(tmp2, cost));
    }
    left = 0;
    right = st.size();
    while (right - left > 1) {
      mid = (left + right) / 2;
      if (st[mid].first >= qq[i].second)
        left = mid;
      else
        right = mid;
    }
    mp[qq[i]] = st[st.size() - 1].second - st[left].second;
  }
  for (i = 0; i < quer.size(); i++) printf("%d\n", mp[quer[i]]);
  return 0;
}
