#include <bits/stdc++.h>
using namespace std;
struct query {
  int x, y, ind;
  bool type;
  query(int a, int b) : x(a), y(b) { type = 0; }
  query(int a, int b, int c) : x(a), y(b), ind(c) { type = 1; }
  query() {}
  bool operator<(const query &q) const {
    return (x != q.x) ? (x > q.x) : !type;
  }
};
vector<int> t, d;
int n, m, h;
vector<query> q;
vector<int> ans, coord, tmp;
map<int, int> comp;
void build() {
  for (int i = n - 1; i > 0; i--) t[i] = t[i << 1] + t[i << 1 | 1];
}
void apply(int i) {
  t[i] = 0;
  if (i < n) d[i] = 1;
}
void calc(int i) {
  if (d[i])
    t[i] = 0;
  else
    t[i] = t[i << 1] + t[i << 1 | 1];
}
void push(int l, int r) {
  int s = h;
  for (l += n, r += n - 1; s > 0; s--)
    for (int i = l >> s; i <= r >> s; i++)
      if (d[i]) {
        apply(i << 1);
        apply(i << 1 | 1);
        d[i] = 0;
      }
}
void build(int l, int r) {
  for (l += n, r += n - 1; l > 0;) {
    r >>= 1, l >>= 1;
    for (int i = r; i >= l; i--) calc(i);
  }
}
void modify(int l, int r) {
  push(l, l + 1);
  push(r - 1, r);
  int l0 = l, r0 = r;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l & 1) apply(l++);
    if (r & 1) apply(--r);
  }
  build(l0, l0 + 1);
  build(r0 - 1, r0);
}
int answer(int l, int r) {
  push(l, l + 1);
  push(r - 1, r);
  int ans = 0;
  for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
    if (l & 1) ans += t[l++];
    if (r & 1) ans += t[--r];
  }
  return ans;
}
int main() {
  int a, b, N, mini = 1061109567;
  scanf("%d", &N);
  n = 0;
  for (int i = 0; i < N; i++) {
    scanf("%d", &a);
    scanf("%d", &b);
    b += a;
    q.push_back(query(a, b));
    coord.push_back(a);
    coord.push_back(b);
  }
  sort(coord.begin(), coord.end());
  int u = 0;
  for (int i = 0; i < coord.size(); i++) {
    if (!i || coord[i] != coord[i - 1]) {
      comp[coord[i]] = u++;
      tmp.push_back(coord[i]);
    }
  }
  coord = tmp;
  scanf("%d", &m);
  n = comp.size() - 1;
  h = sizeof(int) * 8 - __builtin_clz(n);
  d.resize(n, 0);
  t.resize(n * 2);
  for (int i = 0; i < coord.size() - 1; i++) t[i + n] = coord[i + 1] - coord[i];
  ans.resize(m);
  build();
  for (int i = 0; i < m; i++) {
    scanf("%d", &a);
    scanf("%d", &b);
    q.push_back(query(q[a - 1].x, q[b - 1].x, i));
  }
  sort(q.begin(), q.end());
  for (int j = 0; j < q.size(); j++) {
    q[j].x = comp[q[j].x];
    q[j].y = comp[q[j].y];
    if (q[j].type) {
      ans[q[j].ind] = answer(q[j].x, q[j].y);
    } else {
      modify(q[j].x, q[j].y);
    }
  }
  for (int i = 0; i < m; i++) printf("%d\n", ans[i]);
  return 0;
}
