#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int dp[N][20];
int ds[N][20];
int n, p[N], l[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d %d", p + i, l + i);
  p[n + 1] = p[n];
  dp[n + 1][0] = n + 1;
  ds[n + 1][0] = 0;
  for (int i = n; i >= 1; i--) {
    int nx = i + 1;
    int s = p[i + 1] - p[i];
    while (nx <= n and p[i] + l[i] >= p[nx]) {
      s = ds[nx][0];
      nx = dp[nx][0];
    }
    s = min(s, p[nx] - (p[i] + l[i]));
    if (s < 0) s = 0;
    dp[i][0] = nx;
    ds[i][0] = s;
  }
  for (int j = 1; j < 20; j++) {
    for (int i = 1; i <= n + 1; i++) {
      dp[i][j] = dp[dp[i][j - 1]][j - 1];
      ds[i][j] = ds[i][j - 1] + ds[dp[i][j - 1]][j - 1];
    }
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    int x, y;
    scanf("%d %d", &x, &y);
    int ans = 0;
    for (int j = 19; j >= 0; j--) {
      if (dp[x][j] <= y) {
        ans += ds[x][j];
        x = dp[x][j];
      }
    }
    printf("%d\n", ans);
  }
}
