#include <bits/stdc++.h>
using namespace std;
const int maxN = 200000 + 10;
int n;
int p[maxN], lo[maxN];
int h[maxN << 1], nh;
struct node {
  int l, r, s;
};
node tree[maxN * 2 * 3];
void build(int l, int r, int idx) {
  tree[idx].l = l, tree[idx].r = r;
  if (l == r) {
    tree[idx].s = h[l + 1] - h[l];
    return;
  }
  int mid = (l + r) >> 1;
  build(l, mid, idx << 1);
  build(mid + 1, r, idx << 1 | 1);
  tree[idx].s = tree[idx << 1].s + tree[idx << 1 | 1].s;
}
struct group {
  int l, r, idx;
  inline void in(int &_idx) {
    idx = _idx;
    int a, b;
    scanf("%d %d", &a, &b);
    a--, b--;
    l = p[a], r = p[b];
  }
  inline bool operator<(const group &s) const {
    if (l == s.l) return r < s.r;
    return l < s.l;
  }
};
group g[maxN];
int ng;
int res[maxN];
int get_hash(int val) { return lower_bound(h, h + nh, val) - h; }
void update(int l, int r, int idx = 1) {
  if (l <= tree[idx].l && tree[idx].r <= r) {
    tree[idx].s = 0;
    return;
  }
  if (tree[idx].s == 0) return;
  int mid = (tree[idx].l + tree[idx].r) >> 1;
  if (l <= mid) update(l, r, idx << 1);
  if (r > mid) update(l, r, idx << 1 | 1);
  tree[idx].s = tree[idx << 1].s + tree[idx << 1 | 1].s;
}
int query(int l, int r, int idx = 1) {
  if (l <= tree[idx].l && tree[idx].r <= r) return tree[idx].s;
  if (tree[idx].s == 0) return 0;
  int mid = (tree[idx].l + tree[idx].r) >> 1;
  if (r <= mid)
    return query(l, r, idx << 1);
  else if (l > mid)
    return query(l, r, idx << 1 | 1);
  else
    return query(l, mid, idx << 1) + query(mid + 1, r, idx << 1 | 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d %d", &p[i], &lo[i]);
  nh = 0;
  for (int i = 0; i < n; i++) {
    h[nh++] = p[i];
    h[nh++] = p[i] + lo[i];
  }
  sort(h, h + nh);
  nh = unique(h, h + nh) - h;
  build(0, nh - 2, 1);
  scanf("%d", &ng);
  for (int i = 0; i < ng; i++) g[i].in(i);
  sort(g, g + ng);
  int rht = n - 1;
  for (int i = ng - 1; i >= 0; i--) {
    while (rht >= 0 && get_hash(p[rht]) >= get_hash(g[i].l)) {
      update(get_hash(p[rht]), get_hash(p[rht] + lo[rht]) - 1);
      rht--;
    }
    res[g[i].idx] = query(get_hash(g[i].l), get_hash(g[i].r) - 1);
  }
  for (int i = 0; i < ng; i++) printf("%d\n", res[i]);
  return 0;
}
