#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
inline void base() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(6);
}
const int N = 2e5;
long long P[N + 5];
long long L[N + 5];
long long sp[20][N + 5];
long long cs[20][N + 5];
long long costDown[N + 5];
long long st[4 * N + 5];
int n;
void upd(int x, int val, int id = 1, int l = 0, int r = n - 1) {
  if (l == r) {
    st[id] = val;
    return;
  }
  int m = (l + r) / 2;
  if (x <= m)
    upd(x, val, id * 2, l, m);
  else
    upd(x, val, id * 2 + 1, m + 1, r);
  st[id] = max(st[id * 2], st[id * 2 + 1]);
}
int get(int L, int R, int id = 1, int l = 0, int r = n - 1) {
  if (l > R || r < L) return -1;
  if (l >= L && r <= R) return st[id];
  int m = (l + r) / 2;
  return max(get(L, R, id * 2, l, m), get(L, R, id * 2 + 1, m + 1, r));
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%lld%lld", &P[i], &L[i]);
  sp[0][n - 1] = n - 1;
  cs[0][n - 1] = 0;
  costDown[n - 1] = 1e18;
  for (int i = n - 2; i >= 0; --i) {
    costDown[i] = 1e18;
    int l = i + 1, r = n - 1;
    long long tar = P[i] + L[i];
    while (l < r) {
      int m = (l + r) / 2;
      if (P[m] > tar)
        r = m;
      else
        l = m + 1;
    }
    int nx = l;
    if (l > i + 1) nx = max(nx, get(i + 1, l - 1));
    sp[0][i] = nx;
    cs[0][i] = costDown[nx] = min(max(P[nx] - tar, 0LL), costDown[nx]);
    upd(i, nx);
  }
  for (int i = 1; i < 19; ++i) {
    for (int j = 0; j < n; ++j) {
      sp[i][j] = sp[i - 1][sp[i - 1][j]];
      cs[i][j] = cs[i - 1][j] + cs[i - 1][sp[i - 1][j]];
    }
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    x--, y--;
    long long ans = 0;
    for (int i = 18; i >= 0; --i) {
      if (sp[i][x] > y) continue;
      ans += cs[i][x], x = sp[i][x];
    }
    printf("%lld\n", ans);
  }
  return 0;
}
