#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200005;
int a[MAXN];
int b[MAXN];
int w[MAXN];
int to[MAXN];
int n;
int dp[MAXN][20];
void get() {
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < 20; j++) dp[i][j] = n;
  for (int i = 1; i <= n; i++) dp[i][0] = to[i];
  for (int i = 1; i < 20; i++)
    for (int j = 1; j <= n; j++) dp[j][i] = dp[dp[j][i - 1]][i - 1];
}
int getfa(int u, int x) {
  for (int i = 0; i < 20; i++)
    if ((1 << i) & x) u = dp[u][i];
  return u;
}
long long dis[MAXN];
long long erfen(int u, int v) {
  long long ans = 0;
  int l = 0, r = n;
  while (l <= r) {
    int m = l + r >> 1;
    int fa = getfa(u, m);
    if (w[fa] >= a[v]) {
      ans = dis[u] - dis[fa];
      r = m - 1;
    } else
      l = m + 1;
  }
  return ans;
}
int mx[MAXN << 2];
int id[MAXN << 2];
void pushup(int o) {
  if (mx[o << 1] <= mx[o << 1 | 1]) {
    mx[o] = mx[o << 1 | 1];
    id[o] = id[o << 1 | 1];
  } else {
    mx[o] = mx[o << 1];
    id[o] = id[o << 1];
  }
}
void update(int l, int r, int o, int p, int v1, int v2) {
  if (l == r) {
    mx[o] = v1;
    id[o] = v2;
    return;
  }
  int m = l + r >> 1;
  if (p <= m)
    update(l, m, o << 1, p, v1, v2);
  else
    update(m + 1, r, o << 1 | 1, p, v1, v2);
  pushup(o);
}
int go1, go2;
void query(int l, int r, int o, int L, int R) {
  if (L <= l && r <= R) {
    if (mx[o] == 0) return;
    if (go1 < mx[o]) {
      go1 = mx[o];
      go2 = id[o];
    }
    return;
  }
  int m = l + r >> 1;
  if (L <= m) query(l, m, o << 1, L, R);
  if (m < R) query(m + 1, r, o << 1 | 1, L, R);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &b[i]);
  }
  w[n] = a[n];
  to[n] = n;
  for (int i = n - 1; i >= 1; i--) {
    int len = a[i] + b[i];
    if (len < a[i + 1]) {
      to[i] = i + 1;
      w[i] = len;
      update(1, n, 1, i, w[i], i);
      continue;
    }
    int pos = upper_bound(a + i + 1, a + n, len) - a;
    if (len >= a[n]) {
      to[i] = n;
      w[i] = a[n];
      update(1, n, 1, i, w[i], i);
      continue;
    }
    if (a[pos] > len) {
      go1 = go2 = 0;
      query(1, n, 1, i + 1, pos - 1);
      to[i] = to[go2];
      w[i] = go1;
      if (w[i] < len) {
        w[i] = len;
        to[i] = pos;
      }
    }
    update(1, n, 1, i, w[i], i);
  }
  get();
  for (int i = n; i >= 1; i--) dis[i] = dis[to[i]] + a[to[i]] - w[i];
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    cout << erfen(l, r) << endl;
  }
  return 0;
}
