#include <bits/stdc++.h>
using namespace std;
int N, Q;
struct domino {
  int l, r, id;
} bin[400010];
struct qq {
  int l, r, id, ans;
  friend bool operator<(const qq &a, const qq &b) { return a.l < b.l; }
} q[400010];
int aa[400010 * 2];
struct node {
  int flg = 0;
  int l, r, ans = 0;
} e[400010 * 4];
void update(const int &x) {
  if (!e[x].flg) e[x].ans = e[(x << 1)].ans + e[((x << 1) + 1)].ans;
}
void build(const int &l, const int &r, const int &x) {
  if (l > r) return;
  e[x].l = l, e[x].r = r;
  if (l == r) {
    e[x].flg = 0;
    e[x].ans = aa[l + 1] - aa[l];
    return;
  }
  int mid = (e[x].l + e[x].r) >> 1;
  build(l, mid, (x << 1));
  build(mid + 1, r, ((x << 1) + 1));
  update(x);
}
void add(const int &l, const int &r, const int &x) {
  if (e[x].l >= l && e[x].r <= r) {
    e[x].flg += 1;
    e[x].ans = 0;
    return;
  }
  int mid = (e[x].l + e[x].r) >> 1;
  if (l <= mid) add(l, r, (x << 1));
  if (r > mid) add(l, r, ((x << 1) + 1));
  update(x);
}
void del(const int &l, const int &r, const int &x) {
  if (e[x].l >= l && e[x].r <= r) {
    --e[x].flg;
    if (!e[x].flg)
      e[x].ans = (e[x].l == e[x].r) ? aa[e[x].l + 1] - aa[e[x].l]
                                    : (e[(x << 1)].ans + e[((x << 1) + 1)].ans);
    return;
  }
  int mid = (e[x].l + e[x].r) >> 1;
  if (l <= mid) del(l, r, (x << 1));
  if (r > mid) del(l, r, ((x << 1) + 1));
  update(x);
}
int query(const int &l, const int &r, const int &x) {
  if (e[x].flg) return 0;
  if (e[x].l >= l && e[x].r <= r) return e[x].ans;
  int mid = (e[x].l + e[x].r) >> 1;
  int res = 0;
  if (l <= mid) res += query(l, r, (x << 1));
  if (r > mid) res += query(l, r, ((x << 1) + 1));
  return res;
}
void li() {
  sort(aa + 1, aa + N * 2);
  int tot = unique(aa + 1, aa + 1 + N * 2) - aa - 1;
  for (int i = 1; i <= N; i++) {
    bin[i].l = lower_bound(aa + 1, aa + 1 + tot, bin[i].l) - aa;
    bin[i].r = lower_bound(aa + 1, aa + 1 + tot, bin[i].r) - aa;
  }
  build(1, tot, 1);
}
int abin[400010];
signed main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    bin[i].l = a, bin[i].r = a + b, bin[i].id = i;
    aa[i * 2 - 1] = a, aa[i * 2] = a + b;
  }
  li();
  cin >> Q;
  for (int i = 1; i <= Q; i++) {
    q[i].id = i;
    scanf("%d %d", &q[i].l, &q[i].r);
  }
  sort(q + 1, q + 1 + Q);
  for (int i = 1; i <= N; i++) {
    add(bin[i].l, bin[i].r - 1, 1);
  }
  int tot = 1;
  for (int i = 1; i <= Q; i++) {
    int ll = bin[q[i].l].l, rr = bin[q[i].r].l;
    while (tot <= N && tot < q[i].l) {
      del(bin[tot].l, bin[tot].r - 1, 1);
      ++tot;
    }
    q[i].ans = query(ll, rr, 1);
    abin[q[i].id] = q[i].ans;
  }
  for (int i = 1; i <= Q; i++) printf("%d\n", abin[i]);
  return 0;
}
