#include <bits/stdc++.h>
using namespace std;
struct Counter {
  static int k;
  Counter() { k++; }
  ~Counter() { k--; }
};
int Counter::k = 0;
template <typename T>
void pr(const string& name, T t) {
  cout << name << " = " << t << endl;
}
template <typename T, typename... Types>
void pr(const string& names, T t, Types... rest) {
  auto comma_pos = names.find(',');
  cout << names.substr(0, comma_pos) << " = " << t << ", ";
  auto next_name_pos = names.find_first_not_of(" \t\n", comma_pos + 1);
  pr(string(names, next_name_pos), rest...);
}
void mod(long long& a, long long b) {
  a %= b;
  if (a < 0) a += b;
}
const long long MOD = 1000000007;
const int INF = 1000000000;
const int MAX = 200005;
const int RIGHT = 262144;
const int SIZE = 530000;
int Ans[MAX], N, E[MAX], High[SIZE], X[MAX], Next[MAX], H[MAX], Q, Lazy[SIZE],
    T[SIZE];
vector<pair<int, int>> Queries[MAX];
int query(int l, int r, int n, int a, int b) {
  if (a > r || b < l) return 0;
  if (a >= l && b <= r) return T[n];
  if (Lazy[n] >= 0) {
    Lazy[2 * n] = Lazy[n];
    Lazy[2 * n + 1] = Lazy[n];
    T[2 * n] = Lazy[n];
    T[2 * n + 1] = Lazy[n];
    Lazy[n] = -1;
  }
  int mid = (a + b) / 2;
  int ql = query(l, r, 2 * n, a, mid);
  int qr = query(l, r, 2 * n + 1, mid + 1, b);
  return ql + qr;
}
void update(int l, int r, int v, int n, int a, int b) {
  if (a > r || b < l) return;
  if (a >= l && b <= r) {
    Lazy[n] = v;
    T[n] = v;
    return;
  }
  if (Lazy[n] >= 0) {
    Lazy[2 * n] = Lazy[n];
    Lazy[2 * n + 1] = Lazy[n];
    T[2 * n] = Lazy[n];
    T[2 * n + 1] = Lazy[n];
    Lazy[n] = -1;
  }
  int mid = (a + b) / 2;
  update(l, r, v, 2 * n, a, mid);
  update(l, r, v, 2 * n + 1, mid + 1, b);
  T[n] = T[2 * n] + T[2 * n + 1];
}
int query_high(int l, int r, int n, int a, int b) {
  if (a > r || b < l) return 0;
  if (a >= l && b <= r) return High[n];
  int mid = (a + b) / 2;
  int ql = query_high(l, r, 2 * n, a, mid);
  int qr = query_high(l, r, 2 * n + 1, mid + 1, b);
  return max(ql, qr);
}
void update_high(int x, int v, int n, int a, int b) {
  if (a > x || b < x) return;
  if (a == b) {
    High[n] = v;
    return;
  }
  int mid = (a + b) / 2;
  update_high(x, v, 2 * n, a, mid);
  update_high(x, v, 2 * n + 1, mid + 1, b);
  High[n] = max(High[2 * n], High[2 * n + 1]);
}
int main() {
  cin >> N;
  for (int i = (1); i <= (N); i++) cin >> X[i] >> H[i];
  cin >> Q;
  for (int i = (1); i <= (Q); i++) {
    int l, r;
    cin >> l >> r;
    Queries[l].push_back({r, i});
  }
  for (int i = (0); i <= (SIZE - 1); i++) Lazy[i] = -1;
  for (int i = (N); i >= (1); i--) {
    E[i] = X[i] + H[i];
    if (E[i] >= X[i + 1]) E[i] = max(E[i], E[i + 1]);
    int idx = upper_bound(X + 1, X + N + 1, E[i]) - X;
    int high = query_high(i + 1, idx - 1, 1, 1, RIGHT);
    E[i] = max(E[i], high);
    idx = upper_bound(X + 1, X + N + 1, E[i]) - X;
    update_high(i, E[i], 1, 1, RIGHT);
    update(i + 1, idx - 1, 0, 1, 1, RIGHT);
    update(idx, idx, X[idx] - E[i], 1, 1, RIGHT);
    for (pair<int, int> p : Queries[i])
      Ans[p.second] = query(i + 1, p.first, 1, 1, RIGHT);
  }
  for (int i = (1); i <= (Q); i++) cout << Ans[i] << "\n";
}
