#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x = 0;
  bool f = 0;
  char c;
  for (; (c = getchar()) < '0' || c > '9'; f = c == '-')
    ;
  for (x = c - '0'; (c = getchar()) >= '0' && c <= '9';
       x = (x << 3) + (x << 1) + c - '0')
    ;
  return f ? -x : x;
}
struct dom {
  int l, r, y;
} d[200005];
struct que {
  int l, r, id;
} q[200005];
int sum[(1 << 20)], a[200005 << 1], res[200005];
int n, cnt, m, cur, lp, rp;
bool tag[(1 << 20)];
inline bool cmp(que x, que y) { return (x.l == y.l) ? x.r < y.r : x.l < y.l; }
inline void up(int x) { sum[x] = sum[(x << 1)] + sum[(x << 1 | 1)]; }
inline void pushdown(int x, int l, int r) {
  if (!tag[x]) return;
  tag[(x << 1)] = tag[(x << 1 | 1)] = 1;
  tag[x] = 0;
  sum[(x << 1)] = a[((l + r) >> 1)] - a[l - 1];
  sum[(x << 1 | 1)] = a[r] - a[((l + r) >> 1)];
}
inline void update(int x, int l, int r, int A, int B) {
  if (A <= l && B >= r) {
    sum[x] = a[r] - a[l - 1];
    tag[x] = 1;
    return;
  }
  pushdown(x, l, r);
  if (A <= ((l + r) >> 1)) update((x << 1), l, ((l + r) >> 1), A, B);
  if (B > ((l + r) >> 1)) update((x << 1 | 1), ((l + r) >> 1) + 1, r, A, B);
  up(x);
}
inline int query(int x, int l, int r, int a, int b) {
  if (a <= l && b >= r) return sum[x];
  pushdown(x, l, r);
  if (b <= ((l + r) >> 1)) return query((x << 1), l, ((l + r) >> 1), a, b);
  if (a > ((l + r) >> 1))
    return query((x << 1 | 1), ((l + r) >> 1) + 1, r, a, b);
  return (query((x << 1), l, ((l + r) >> 1), a, ((l + r) >> 1)) +
          query((x << 1 | 1), ((l + r) >> 1) + 1, r, ((l + r) >> 1) + 1, b));
}
int main() {
  n = in();
  for (int i = 1; i <= n; ++i) {
    d[i].l = in();
    d[i].y = in();
    d[i].r = d[i].l + d[i].y;
    a[++cnt] = d[i].l;
    a[++cnt] = d[i].r;
  }
  sort(a + 1, a + cnt + 1);
  cnt = unique(a + 1, a + cnt + 1) - a - 1;
  m = in();
  for (int i = 1; i <= m; ++i) {
    q[i].l = in();
    q[i].r = in();
    q[i].id = i;
  }
  sort(q + 1, q + m + 1, cmp);
  cur = n;
  for (int i = m; i; --i) {
    while (cur >= q[i].l) {
      lp = lower_bound(a + 1, a + cnt + 1, d[cur].l) - a + 1;
      rp = lower_bound(a + 1, a + cnt + 1, d[cur].r) - a;
      update(1, 1, cnt - 1, lp, rp);
      --cur;
    }
    int x = q[i].l, y = q[i].r;
    lp = lower_bound(a + 1, a + cnt + 1, d[x].l) - a + 1;
    rp = lower_bound(a + 1, a + cnt + 1, d[y].l) - a;
    res[q[i].id] = d[y].l - d[x].l - query(1, 1, cnt - 1, lp, rp);
  }
  for (int i = 1; i <= m; ++i) printf("%d\n", res[i]);
  return 0;
}
