#include <bits/stdc++.h>
using namespace std;
const long long MOD = (1 ? 100000000000000007 : 233333333333333333);
const int mod = (1 ? 1000000007 : 998244353);
const long long INF = 0x7fffffffffffffff;
const int inf = 0x7fffffff;
const double eps = 1e-8;
const int N = 2e5 + 5;
clock_t start, finish;
void time_in() { start = clock(); }
void time_out() {
  finish = clock();
  double tim = (double)(finish - start) / CLOCKS_PER_SEC;
  printf("Running time is %lf\n", tim);
}
inline long long mul(long long a, long long b) {
  long long s = 0;
  while (b) {
    if (b & 1) s = (s + a) % mod;
    a = (a << 1) % mod;
    b >>= 1;
  }
  return s % mod;
}
inline long long pow_mul(long long a, long long b) {
  long long s = 1;
  while (b) {
    if (b & 1) s = mul(s, a);
    a = mul(a, a);
    b >>= 1;
  }
  return s;
}
inline long long poww(long long a, long long b) {
  long long s = 1;
  while (b) {
    if (b & 1) s = (s * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return s % mod;
}
inline int read() {
  char c = getchar();
  int sgn = 1, ret = 0;
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  if (c == '-') sgn = -1, c = getchar();
  while (c >= '0' && c <= '9') ret = ret * 10 + c - 48, c = getchar();
  return ret * sgn;
}
void write(int x) {
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline long long phi(long long x) {
  long long ans = x;
  for (long long i = 2; i * i <= x; i++)
    if (x % i == 0) {
      ans -= ans / i;
      while (x % i == 0) x /= i;
    }
  if (x > 1) ans -= ans / x;
  return ans;
}
int st[5][3] = {-1, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 1};
int t, cas;
int n;
struct node {
  int l, r, ans, id;
} que[N];
struct xxxx {
  int h, l, r;
} gn[N];
bool cmp1(node x, node y) {
  if (x.l != y.l) return x.l > y.l;
  return x.r > y.r;
}
bool cmp2(node x, node y) { return x.id < y.id; }
int arr[N << 1], an;
int tree[N << 3];
bool cover[N << 3];
void push_up(int rt) { tree[rt] = tree[rt << 1] + tree[rt << 1 | 1]; }
void push_down(int l, int r, int rt) {
  if (cover[rt] == true) {
    cover[rt << 1] = cover[rt << 1 | 1] = true;
    int m = (l + r) / 2;
    tree[rt << 1] = arr[m + 1] - arr[l];
    tree[rt << 1 | 1] = arr[r + 1] - arr[m + 1];
    cover[rt] = false;
  }
}
void insert(int L, int R, int l, int r, int rt) {
  if (L <= l && r <= R) {
    tree[rt] = arr[r + 1] - arr[l];
    cover[rt] = true;
    return;
  }
  push_down(l, r, rt);
  int m = (l + r) / 2;
  if (L <= m) insert(L, R, l, m, rt << 1);
  if (R > m) insert(L, R, m + 1, r, rt << 1 | 1);
  push_up(rt);
}
int query(int L, int R, int l, int r, int rt) {
  if (L <= l && r <= R) {
    return tree[rt];
  }
  push_down(l, r, rt);
  int m = (l + r) / 2;
  int ret = 0;
  if (L <= m) ret += query(L, R, l, m, rt << 1);
  if (R > m) ret += query(L, R, m + 1, r, rt << 1 | 1);
  return ret;
}
int main() {
  while (~scanf("%d", &n)) {
    an = 1;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &gn[i].l, &gn[i].h);
      gn[i].r = gn[i].l + gn[i].h;
      arr[an++] = gn[i].l, arr[an++] = gn[i].r;
    }
    sort(arr + 1, arr + an);
    an = unique(arr + 1, arr + an) - arr;
    int q;
    scanf("%d", &q);
    for (int i = 0; i < q; i++) {
      scanf("%d%d", &que[i].l, &que[i].r);
      que[i].id = i;
    }
    sort(que, que + q, cmp1);
    int nx = n - 1;
    for (int i = 0; i < q; i++) {
      while (nx >= que[i].l - 1) {
        int L = lower_bound(arr + 1, arr + an, gn[nx].l) - arr;
        int R = lower_bound(arr + 1, arr + an, gn[nx].r) - arr - 1;
        insert(L, R, 1, an - 2, 1);
        nx--;
      }
      int a = que[i].l - 1, b = que[i].r - 1;
      int L = lower_bound(arr + 1, arr + an, gn[a].l) - arr;
      int R = lower_bound(arr + 1, arr + an, gn[b].l) - arr - 1;
      que[i].ans = gn[b].l - gn[a].l - query(L, R, 1, an - 2, 1);
    }
    sort(que, que + q, cmp2);
    for (int i = 0; i < q; i++) printf("%d\n", que[i].ans);
  }
}
