#include <bits/stdc++.h>
using namespace std;
int pcrod[222222];
int len[222222];
int lpos[222222];
int rpos[222222];
int ans[222222];
vector<pair<int, int> > queries[444444];
class Fenwick {
 public:
  int arr[222222];
  int size;
  int modify(int x, int val) {
    for (int i = x; i <= size; i += (i & (-i))) arr[i] += val;
    return 0;
  }
  int query(int r) {
    int ans = 0;
    for (int i = r; i > 0; i -= (i & (-i))) ans += arr[i];
    return ans;
  }
};
Fenwick fenwick;
int main(void) {
  int n = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d %d", &pcrod[i], &len[i]);
  int q = 0;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int push = 0;
    int last = 0;
    scanf("%d %d", &push, &last);
    push--;
    last--;
    queries[push].push_back(pair<int, int>(i, last));
  }
  fenwick.size = n + 10;
  set<pair<pair<int, int>, int> > intervals;
  for (int i = n - 2; i >= 0; i--) {
    if (pcrod[i] + len[i] < pcrod[i + 1]) {
      intervals.insert(pair<pair<int, int>, int>(
          pair<int, int>(pcrod[i] + len[i], pcrod[i + 1]), i + 1));
      fenwick.modify(i + 1, pcrod[i + 1] - (pcrod[i] + len[i]));
    }
    while (true) {
      if (intervals.empty()) break;
      auto it = intervals.begin();
      if (pcrod[i] <= it->first.first &&
          pcrod[i] + len[i] >= it->first.second) {
        fenwick.modify(it->second, -(it->first.second - it->first.first));
        intervals.erase(it);
      } else if (pcrod[i] + len[i] > it->first.first) {
        pair<pair<int, int>, int> newOne = pair<pair<int, int>, int>(
            pair<int, int>(pcrod[i] + len[i], it->first.second), it->second);
        fenwick.modify(it->second, -(it->first.second - it->first.first));
        intervals.erase(it);
        intervals.insert(newOne);
        fenwick.modify(newOne.second, newOne.first.second - newOne.first.first);
      } else
        break;
    }
    for (auto query : queries[i]) {
      int id = query.first;
      ans[id] = fenwick.query(query.second);
    }
  }
  for (int i = 0; i < q; i++) printf("%d\n", ans[i]);
  while (getchar() != EOF)
    ;
  return 0;
}
