#include <bits/stdc++.h>
using namespace std;
const int MAXN = 400005;
int n, q, cnt[MAXN];
int a[MAXN], p[MAXN][25], p2[MAXN][25], b[MAXN];
struct gp {
  int x, l;
} G[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &G[i].x, &G[i].l);
    a[i] = G[i].x;
    b[i] = G[i].x + G[i].l;
  }
  memset(p, 0x7F, sizeof(p2));
  for (int i = 1; i <= n; i++) p2[i][0] = i;
  for (int j = 1; j <= 18; j++)
    for (int i = 1; i <= n; i++)
      p2[i][j] = b[p2[i + (1 << (j - 1))][j - 1]] > b[p2[i][j - 1]]
                     ? p2[i + (1 << (j - 1))][j - 1]
                     : p2[i][j - 1];
  int now = 0;
  cnt[n] = 0;
  for (int i = n - 1; i >= 1; i--) {
    int e = 0;
    e = upper_bound(a + i, a + n + 1, b[i]) - a - 1;
    int j = 0, l = i + 1, r = e;
    if (l <= e) {
      for (j = 0; (1 << j) <= r - l + 1; j++) {
      }
      j--;
      now = b[p2[l][j]] > b[p2[r - (1 << j) + 1][j]] ? p2[l][j]
                                                     : p2[r - (1 << j) + 1][j];
    } else
      now = i;
    if (now == i) {
      cnt[i] = cnt[i + 1];
      cnt[i] += G[i + 1].x - (G[i].x + G[i].l);
      continue;
    }
    if (G[i].x + G[i].l <= G[now].x + G[now].l)
      cnt[i] = cnt[now];
    else {
      cnt[i] = cnt[now];
      if (now < n) cnt[i] -= (G[i].x + G[i].l) - (G[now].x + G[now].l);
    }
  }
  memset(p, 0x7F, sizeof(p));
  for (int i = 1; i <= n; i++) p[i][0] = cnt[i];
  for (int j = 1; j <= 18; j++)
    for (int i = 1; i <= n; i++)
      p[i][j] = min(p[i + (1 << (j - 1))][j - 1], p[i][j - 1]);
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    int j = 0;
    for (j = 0; (1 << j) <= r - l + 1; j++)
      ;
    j--;
    int Mi = min(p[l][j], p[r - (1 << j) + 1][j]);
    printf("%d\n", cnt[l] - Mi);
  }
}
