#include <bits/stdc++.h>
using namespace std;
inline void OPEN(const string &s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
int bit[200200], n, p[200200], l[200200], rmq[200200 << 2];
int q, x[200200], y[200200], span[200200], ans[200200];
vector<int> queries[200200];
void update_bit(int k, int v) {
  for (int x = k; x < n; x += (x & -x)) {
    bit[x] += v;
  }
}
int query_bit(int k) {
  int ret = 0;
  for (int x = k; x > 0; x -= (x & -x)) {
    ret += bit[x];
  }
  return ret;
}
int query_bit(int x, int y) { return query_bit(y) - query_bit(x - 1); }
void update_rmq(int v, int l, int r, int x, int value) {
  if (r < x || x < l) return;
  if (l == r) {
    rmq[v] = value;
  } else {
    int vl = v << 1;
    int vr = vl | 1;
    int m = (l + r) >> 1;
    update_rmq(vl, l, m, x, value);
    update_rmq(vr, m + 1, r, x, value);
    rmq[v] = max(rmq[vl], rmq[vr]);
  }
}
int query_rmq(int v, int l, int r, int x, int y) {
  if (r < x || y < l) return 0;
  if (x <= l && r <= y) {
    return rmq[v];
  } else {
    int vl = v << 1;
    int vr = vl | 1;
    int m = (l + r) >> 1;
    return max(query_rmq(vl, l, m, x, y), query_rmq(vr, m + 1, r, x, y));
  }
}
struct RMQ {
  struct RMQInfo {
    int imin, imax;
  };
  RMQ() { this->n = 0; }
  RMQ(int n) { init(n); }
  template <class Iterator>
  RMQ(Iterator begin, Iterator end) {
    init(begin, end);
  }
  void init(int n) {
    this->n = 1;
    while (this->n < n) this->n <<= 1;
    a.clear();
    a.resize(this->n + 1);
    rmq.resize(this->n << 1);
    build(1, 1, this->n);
  }
  template <class Iterator>
  void init(Iterator begin, Iterator end) {
    a.clear();
    a.push_back(0);
    while (begin != end) {
      a.push_back(*begin);
      begin++;
    }
    int n = a.size() - 1;
    this->n = 1;
    while (this->n < n) this->n <<= 1;
    a.resize(this->n + 1);
    rmq.resize(this->n << 1);
    build(1, 1, this->n);
  }
  void build(int v, int l, int r) {
    if (l == r) {
      rmq[v].imin = rmq[v].imax = l;
    } else {
      int vl = v << 1;
      int vr = vl | 1;
      int m = (l + r) >> 1;
      build(vl, l, m);
      build(vr, m + 1, r);
      rmq[v].imin =
          (a[rmq[vl].imin] < a[rmq[vr].imin]) ? rmq[vl].imin : rmq[vr].imin;
      rmq[v].imax =
          (a[rmq[vl].imax] > a[rmq[vr].imax]) ? rmq[vl].imax : rmq[vr].imax;
    }
  }
  void update(int pos, int value) {
    a[pos] = value;
    update(1, 1, n, pos, value);
  }
  void update(int v, int l, int r, int pos, int value) {
    if (l == r) {
      rmq[v].imax = rmq[v].imin = pos;
    } else {
      int vl = v << 1;
      int vr = vl | 1;
      int m = (l + r) >> 1;
      if (pos <= m) {
        update(vl, l, m, pos, value);
      }
      if (m + 1 <= pos) {
        update(vr, m + 1, r, pos, value);
      }
      rmq[v].imin =
          (a[rmq[vl].imin] < a[rmq[vr].imin]) ? rmq[vl].imin : rmq[vr].imin;
      rmq[v].imax =
          (a[rmq[vl].imax] > a[rmq[vr].imax]) ? rmq[vl].imax : rmq[vr].imax;
    }
  }
  int min(int left, int right) {
    RMQInfo result = query(1, 1, n, left, right);
    return a[result.imin];
  }
  int max(int left, int right) {
    RMQInfo result = query(1, 1, n, left, right);
    return a[result.imax];
  }
  int idxMin(int left, int right) {
    RMQInfo result = query(1, 1, n, left, right);
    return result.imin;
  }
  int idxMax(int left, int right) {
    RMQInfo result = query(1, 1, n, left, right);
    return result.imax;
  }
  RMQInfo query(int v, int l, int r, int left, int right) {
    if (left <= l && r <= right) {
      return rmq[v];
    } else {
      int vl = v << 1;
      int vr = vl | 1;
      int m = (l + r) >> 1;
      RMQInfo infoLeft, infoRight, result;
      if (left <= m) {
        infoLeft = query(vl, l, m, left, right);
        if (right <= m) {
          return infoLeft;
        }
      }
      if (right > m) {
        infoRight = query(vr, m + 1, r, left, right);
        if (left > m) {
          return infoRight;
        }
      }
      result.imin = (a[infoLeft.imin] < a[infoRight.imin]) ? infoLeft.imin
                                                           : infoRight.imin;
      result.imax = (a[infoLeft.imax] > a[infoRight.imax]) ? infoLeft.imax
                                                           : infoRight.imax;
      return result;
    }
  }
  int n;
  vector<RMQInfo> rmq;
  vector<int> a;
};
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) scanf("%d%d", &p[i], &l[i]);
  scanf("%d", &q);
  for (int i = 0; i < (q); ++i) {
    scanf("%d%d", &x[i], &y[i]);
    x[i]--;
    y[i]--;
    queries[x[i]].push_back(i);
  }
  int temp = p[0] + l[0];
  for (int i = (1); i <= (n - 1); ++i) {
    if (temp >= p[i]) {
      update_bit(i, 0);
    } else {
      update_bit(i, p[i] - temp);
    }
    temp = max((temp), (p[i] + l[i]));
    ;
  }
  RMQ rmqz(n);
  span[n - 1] = p[n - 1] + l[n - 1];
  rmqz.update(n, span[n - 1]);
  for (int i = (n - 1) - 1; 0 <= i; --i) {
    int reach = p[i] + l[i];
    if (reach < p[i + 1]) {
      span[i] = reach;
    } else {
      int r = lower_bound(p, p + n, reach + 1) - p;
      r--;
      span[i] = rmqz.max(i + 2, r + 1);
      span[i] = max((span[i]), (reach));
      ;
    }
    rmqz.update(i + 1, span[i]);
  }
  for (int i = 0; i < (n); ++i) {
    for (__typeof((queries[i]).begin()) it = (queries[i]).begin();
         it != (queries[i]).end(); it++) {
      if (x[*it] == y[*it]) {
        ans[*it] = 0;
      } else {
        ans[*it] = query_bit(x[*it] + 1, y[*it]);
      }
    }
    if (i == n - 1) continue;
    if (span[i + 1] >= p[i] + l[i]) continue;
    int lp = lower_bound(p, p + n, span[i + 1]) - p;
    int rp = lower_bound(p, p + n, p[i] + l[i]) - p;
    if (rp == n) rp--;
    temp = span[i + 1];
    for (int j = (lp); j <= (rp); ++j) {
      if (temp >= p[j]) {
        update_bit(j, 0 - query_bit(j, j));
      } else {
        update_bit(j, (p[j] - temp) - query_bit(j, j));
      }
      temp = max((temp), (p[j] + l[j]));
      ;
    }
  }
  for (int i = 0; i < (q); ++i) {
    printf("%d\n", ans[i]);
  }
  return 0;
}
