#include <bits/stdc++.h>
using namespace std;
const int N = 2E5 + 5;
struct map {
  int x, w;
} tr[N];
int n, m, p[N], l[N], x, y, f[N][20], c[N][20], ans;
void add(int x, int w, int c) {
  for (; x <= n; x += x & -x)
    if (tr[x].x < w || (tr[x].x == w && tr[x].w > c)) {
      tr[x].x = w;
      tr[x].w = c;
    }
}
int get(int x, int y) {
  int maxi = 0, cost = 2E9;
  for (int pp = y; pp; pp -= pp & -pp)
    if (tr[pp].x > maxi || (tr[pp].x == maxi && tr[pp].w < cost)) {
      maxi = tr[pp].x;
      cost = tr[pp].w;
    }
  if (!maxi) {
    f[x][0] = x + 1;
    c[x][0] = p[x + 1] - (p[x] + l[x]);
  } else {
    f[x][0] = maxi;
    c[x][0] = min(p[maxi] - (p[x] + l[x]), cost);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d%d", &p[i], &l[i]);
  memset(f, 10, sizeof(f));
  add(n, n + 1, 0);
  for (int i = n - 1; i; i--) {
    y = lower_bound(p + 1, p + n + 1, p[i] + l[i] + 1) - p - 1;
    get(i, y);
    for (int j = 1; j < 20; j++)
      if (f[i][j - 1] <= n)
        f[i][j] = f[f[i][j - 1]][j - 1],
        c[i][j] = c[i][j - 1] + c[f[i][j - 1]][j - 1];
    add(i, f[i][0], c[i][0]);
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    ans = 0;
    for (int j = 19; j >= 0; j--)
      if (f[x][j] <= y) {
        ans += c[x][j];
        x = f[x][j];
      }
    printf("%d\n", ans);
  }
}
