#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
template <typename T>
void write(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) {
    write(x / 10);
  }
  putchar(x % 10 + '0');
}
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a / gcd(a, b) * b; };
long long ksm(long long a, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = (ans * a) % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ans % mod;
}
const int maxn = 4e5 + 10;
struct line {
  int l, r, len;
} save[maxn];
int nums[maxn << 2], tot;
struct Q {
  int l, r, id, len;
} qs[maxn];
int n, q;
int val[maxn << 2];
bool cover[maxn << 2];
int pi[maxn], li[maxn], ri[maxn];
void push_down(int l, int r, int rt) {
  if (cover[rt]) {
    cover[(rt << 1)] = true;
    cover[(rt << 1 | 1)] = true;
    int m = ((l + r) >> 1);
    val[(rt << 1)] = nums[m + 1] - nums[l];
    val[(rt << 1 | 1)] = nums[r + 1] - nums[m + 1];
    cover[rt] = false;
  }
}
void push_up(int l, int r, int rt) {
  val[rt] = val[(rt << 1)] + val[(rt << 1 | 1)];
}
void insert(int ql, int qr, int l, int r, int rt) {
  if (ql <= l && r <= qr) {
    val[rt] = nums[r + 1] - nums[l];
    cover[rt] = true;
    return;
  }
  push_down(l, r, rt);
  int m = ((l + r) >> 1);
  if (ql <= m) insert(ql, qr, l, m, (rt << 1));
  if (qr > m) insert(ql, qr, m + 1, r, (rt << 1 | 1));
  push_up(l, r, rt);
}
int query(int ql, int qr, int l, int r, int rt) {
  if (ql <= l && r <= qr) {
    return val[rt];
  }
  push_down(l, r, rt);
  int m = ((l + r) >> 1);
  int res = 0;
  if (ql <= m) res += query(ql, qr, l, m, (rt << 1));
  if (qr > m) res += query(ql, qr, m + 1, r, (rt << 1 | 1));
  push_up(l, r, rt);
  return res;
}
int out[maxn];
int main() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    read(save[i].l), read(save[i].len);
    pi[i] = save[i].l;
    li[i] = save[i].len;
    save[i].r = save[i].l + save[i].len;
    ri[i] = save[i].r;
    nums[++tot] = save[i].l;
    nums[++tot] = save[i].r;
  }
  read(q);
  for (int i = 1; i <= q; ++i) {
    int x, y;
    read(x), read(y);
    qs[i] = {x, y, i, pi[y] - pi[x]};
  }
  sort(nums + 1, nums + 1 + tot);
  int ss = unique(nums + 1, nums + 1 + tot) - nums - 1;
  sort(qs + 1, qs + 1 + q, [](const Q &a, const Q &b) { return a.l > b.l; });
  for (int i = 1; i <= n; ++i) {
    save[i].l = lower_bound(nums + 1, nums + 1 + ss, save[i].l) - nums;
    save[i].r = lower_bound(nums + 1, nums + 1 + ss, save[i].r) - nums;
  }
  int p = n;
  for (int i = 1; i <= q; ++i) {
    while (p >= 1 && p >= qs[i].l) {
      insert(save[p].l, save[p].r - 1, 1, ss, 1);
      --p;
    }
    int L = lower_bound(nums + 1, nums + 1 + ss, pi[qs[i].l]) - nums;
    int R = lower_bound(nums + 1, nums + 1 + ss, pi[qs[i].r]) - nums;
    out[qs[i].id] = (qs[i].len) - query(L, R - 1, 1, ss, 1);
  }
  for (int i = 1; i <= q; ++i) {
    write(out[i]);
    putchar('\n');
  }
  return 0;
}
