#include <bits/stdc++.h>
using namespace std;
int n, m, x, y, a[200001], b[200001], dn = 0, d[200001], p[200001][20],
                                      q[200001][20];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i], &b[i]);
  }
  a[n] = 2100000000;
  b[n] = 0;
  d[dn++] = n;
  p[n][0] = n;
  q[n][0] = 0;
  for (int i = n - 1; i >= 0; i--) {
    while (a[d[dn - 1]] + b[d[dn - 1]] <= a[i] + b[i]) {
      dn--;
    }
    p[i][0] = d[dn - 1];
    if (a[d[dn - 1]] <= a[i] + b[i]) {
      q[i][0] = 0;
    } else {
      q[i][0] = a[d[dn - 1]] - a[i] - b[i];
    }
    d[dn++] = i;
  }
  for (int j = 1; j < 20; j++) {
    for (int i = n; i >= 0; i--) {
      p[i][j] = p[p[i][j - 1]][j - 1];
      q[i][j] = q[i][j - 1] + q[p[i][j - 1]][j - 1];
    }
  }
  scanf("%d", &m);
  for (int j = 0; j < m; j++) {
    scanf("%d %d", &x, &y);
    x--;
    y--;
    int k = x;
    int r = 0;
    for (int i = 19; i >= 0; i--) {
      if (p[k][i] <= y) {
        r += q[k][i];
        k = p[k][i];
      }
    }
    printf("%d\n", r);
  }
  return 0;
}
