#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int n;
struct node {
  int x, h;
} a[maxn];
bool cmp(node a, node b) {
  if (a.x != b.x)
    return a.x < b.x;
  else
    a.h < b.h;
}
int loc[maxn], b[maxn];
int tree[maxn << 2];
int cnt;
void build(int i, int ll, int rr) {
  if (ll == rr) {
    tree[i] = b[++cnt];
  } else {
    int mid = (ll + rr) / 2;
    build(i * 2, ll, mid);
    build(i * 2 + 1, mid + 1, rr);
    tree[i] = max(tree[i * 2], tree[i * 2 + 1]);
  }
}
void update(int i, int x, int v, int ll, int rr) {
  if (ll == rr) {
    tree[i] = v;
    return;
  }
  int mid = (ll + rr) / 2;
  if (x <= mid) {
    update(i * 2, x, v, ll, mid);
  } else {
    update(i * 2 + 1, x, v, mid + 1, rr);
  }
  tree[i] = max(tree[i * 2], tree[i * 2 + 1]);
}
int quest(int i, int l, int r, int ll, int rr) {
  if (ll == l && rr == r) return tree[i];
  int mid = (ll + rr) / 2;
  if (r <= mid) {
    return quest(i * 2, l, r, ll, mid);
  } else if (l > mid) {
    return quest(i * 2 + 1, l, r, mid + 1, rr);
  } else {
    return max(quest(i * 2, l, mid, ll, mid),
               quest(i * 2 + 1, mid + 1, r, mid + 1, rr));
  }
}
int dp[maxn][30], cost[maxn][30];
int main() {
  int i, j, k, x, y, l, r, len, q, ans;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].x, &a[i].h);
  }
  sort(a + 1, a + 1 + n, cmp);
  for (i = 1; i <= n; i++) {
    b[i] = a[i].x + a[i].h;
    loc[i] = a[i].x;
  }
  cnt = 0;
  build(1, 1, n);
  for (i = n; i > 0; i--) {
    b[i] = quest(1, i, upper_bound(loc + i, loc + 1 + n, b[i]) - 1 - loc, 1, n);
    update(1, i, b[i], 1, n);
  }
  for (i = 1; i <= n; i++) {
    y = upper_bound(loc + i, loc + 1 + n, b[i]) - loc;
    if (y > n) {
      y = n;
      len = 0;
    } else
      len = a[y].x - b[i];
    dp[i][0] = y;
    cost[i][0] = len;
  }
  for (j = 1; j < 30; j++) {
    for (i = 1; i <= n; i++) {
      dp[i][j] = dp[dp[i][j - 1]][j - 1];
      cost[i][j] = cost[i][j - 1] + cost[dp[i][j - 1]][j - 1];
    }
  }
  scanf("%d", &q);
  while (q--) {
    ans = 0;
    scanf("%d%d", &l, &r);
    i = l;
    for (j = 29; j >= 0; j--) {
      if (dp[i][j] < r) {
        ans += cost[i][j];
        i = dp[i][j];
      }
    }
    if (dp[i][0] <= r) ans += cost[i][0];
    printf("%d\n", ans);
  }
  return 0;
}
