#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5;
int bit[N];
int pos[N];
int len[N];
int n;
int answer[N];
int gapSize[N];
vector<pair<int, int> > queries[N];
void put(int at, int by) {
  int delta = by - gapSize[at];
  gapSize[at] = by;
  while (at < n) {
    bit[at] += delta;
    at |= at + 1;
  }
}
int get(int at) {
  int result = 0;
  while (at >= 0) {
    result += bit[at];
    at -= ~at & (at + 1);
  }
  return result;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> pos[i] >> len[i];
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    int x;
    cin >> x;
    --x;
    int y;
    cin >> y;
    --y;
    queries[x].push_back(make_pair(y, i));
  }
  stack<int> gaps;
  for (int i = n - 2; i >= 0; --i) {
    if (pos[i] + len[i] < pos[i + 1]) {
      gaps.push(i + 1);
      put(i + 1, pos[i + 1] - (pos[i] + len[i]));
    } else {
      while (!gaps.empty() && pos[i] + len[i] >= pos[gaps.top()]) {
        put(gaps.top(), 0);
        gaps.pop();
      }
      if (!gaps.empty()) {
        int newSize = pos[gaps.top()] - (pos[i] + len[i]);
        if (newSize < gapSize[gaps.top()]) {
          put(gaps.top(), newSize);
        }
      }
    }
    for (int j = 0; j < (int)queries[i].size(); ++j) {
      answer[queries[i][j].second] = get(queries[i][j].first);
    }
  }
  for (int i = 0; i < m; ++i) {
    printf("%d\n", answer[i]);
  }
  return 0;
}
