#include <bits/stdc++.h>
using namespace std;
class SegmentTree {
 private:
  struct Segment {
    int l, r;
    int x;
    bool p;
    int px;
    Segment() : l(-1), r(-1), x(0), p(false), px(0) {}
  };
  vector<Segment> t;
  int tl, tr;
  int get(int v, int l, int r) {
    if (!t[v].p) return t[v].x;
    return (r - l) * t[v].px;
  }
  void push(int v, int l, int r) {
    if (!t[v].p) return;
    if (l + 1 == r)
      t[v].x = t[v].px, t[v].p = false;
    else {
      int m = (l + 0LL + r) / 2;
      if (t[v].l == -1) t[v].l = t.size(), t.push_back(Segment());
      if (t[v].r == -1) t[v].r = t.size(), t.push_back(Segment());
      t[t[v].l].px = t[v].px, t[t[v].l].p = true;
      t[t[v].r].px = t[v].px, t[t[v].r].p = true;
      t[v].px = 0, t[v].p = false;
      t[v].x = get(t[v].l, l, m) + get(t[v].r, m, r);
    }
  }
  void update(int v, int l, int r, int lq, int rq, int x) {
    if (l >= r || lq >= rq) return;
    if (lq == l && rq == r)
      t[v].px = x, t[v].p = true;
    else {
      int m = (l + 0LL + r) / 2;
      int f = 0, s = 0;
      push(v, l, r);
      if (lq < min(rq, m)) {
        if (t[v].l == -1) t[v].l = t.size(), t.push_back(Segment());
        update(t[v].l, l, m, lq, min(rq, m), x);
      }
      if (max(lq, m) < rq) {
        if (t[v].r == -1) t[v].r = t.size(), t.push_back(Segment());
        update(t[v].r, m, r, max(lq, m), rq, x);
      }
      if (t[v].l != -1) f = get(t[v].l, l, m);
      if (t[v].r != -1) s = get(t[v].r, m, r);
      t[v].x = f + s;
    }
  }
  int query(int v, int l, int r, int lq, int rq) {
    if (l >= r || lq >= rq) return 0;
    if (l == lq && r == rq) return get(v, l, r);
    int m = (l + 0LL + r) / 2;
    int f = 0, s = 0;
    push(v, l, r);
    if (t[v].l != -1) f = query(t[v].l, l, m, lq, min(rq, m));
    if (t[v].r != -1) s = query(t[v].r, m, r, max(lq, m), rq);
    return f + s;
  }

 public:
  SegmentTree(int l, int r) : t(), tl(l), tr(r) { t.push_back(Segment()); }
  void update(int l, int r, int x) { update(0, tl, tr, l, r, x); }
  int query(int l, int r) { return query(0, tl, tr, l, r); }
};
const int N = (int)2e5 + 1, B = (int)2e9 + 1;
int n, m, x, y;
pair<int, int> d[N];
pair<pair<int, int>, int> q[N];
int ans[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x, &y);
    d[i] = make_pair(x, x + y);
  }
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x, &y), x--, y--;
    q[i] = make_pair(make_pair(x, y), i);
  }
  sort(q, q + m);
  SegmentTree t(1, B);
  int it = n - 1;
  for (int i = m - 1; i >= 0; i--) {
    int ld = q[i].first.first;
    int rd = q[i].first.second;
    int qi = q[i].second;
    while (it >= 0 && ld <= it) {
      t.update(d[it].first, d[it].second, 1);
      it--;
    }
    int cnt = t.query(d[ld].first, d[rd].first);
    ans[qi] = d[rd].first - d[ld].first - cnt;
  }
  for (int i = 0; i < m; i++) printf("%d\n", ans[i]);
  return 0;
}
