#include <bits/stdc++.h>
using namespace std;
const int mn = 2e5 + 9;
int l[mn];
int x[mn];
int n;
const int cm = 3;
const int c[cm] = {5000, 1000, 100};
const int mm = mn / 100 + 1;
int nx2[cm][mm];
map<int, int> ma[cm][mm];
map<int, int, greater<int> > ma2[cm][mm];
void init(int p, int c) {
  int k;
  for (int i = 0; i < n / c; i++) {
    vector<pair<int, int> > ve;
    k = i * c;
    int x2 = -100;
    for (int j = 0; j < c; j++) {
      if (x2 < x[k]) {
        ve.push_back(make_pair(x2, x[k]));
      }
      x2 = max(x2, x[k] + l[k]);
      k++;
    }
    nx2[p][i] = x2;
    int co = 0;
    ma[p][i][2 * 1e9 + 9] = 0;
    for (int j = ve.size() - 1; j >= 0; j--) {
      co += ve[j].second - ve[j].first;
      ma[p][i][ve[j].first] = co;
      ma2[p][i][ve[j].first] = ve[j].second;
    }
  }
}
pair<int, int> f(int u, int v, int xi) {
  int x2 = xi;
  int p;
  int res = 0;
  map<int, int>::iterator it, i2;
  for (int k = u; k <= v;) {
    bool q = 0;
    for (int h = 0; h < cm && !q; h++) {
      if (k % c[h] == 0 && k + c[h] - 1 <= v) {
        p = k / c[h];
        it = ma[h][p].lower_bound(x2);
        res += it->second;
        i2 = ma2[h][p].lower_bound(x2);
        if (i2 != ma2[h][p].end() && i2->first != it->first &&
            i2->second > x2) {
          res += i2->second - x2;
        }
        x2 = max(x2, nx2[h][p]);
        k += c[h];
        q = 1;
      }
    }
    if (q) continue;
    if (x2 < x[k]) {
      res += x[k] - x2;
    }
    x2 = max(x2, x[k] + l[k]);
    k++;
  }
  return make_pair(res, x2);
}
vector<pair<pair<int, int>, int> > vq;
int res[mn];
int main() {
  scanf("%d", &(n));
  for (int i = 0; i < n; i++) {
    scanf("%d", &(x[i]));
    scanf("%d", &(l[i]));
  }
  for (int h = 0; h < cm; h++) {
    init(h, c[h]);
  }
  int k;
  int u, v, ind;
  int q;
  scanf("%d", &(q));
  for (int i = 0; i < q; i++) {
    scanf("%d", &(u));
    scanf("%d", &(v));
    vq.push_back(make_pair(make_pair(u - 1, v - 1), i));
  }
  sort((vq).begin(), (vq).end());
  int lu = -1e9;
  int lx;
  int lr;
  int lv;
  pair<int, int> pr;
  for (int i = 0; i < q; i++) {
    u = vq[i].first.first;
    v = vq[i].first.second;
    ind = vq[i].second;
    if (u == lu) {
      pr = f(lv, v, lx);
      res[ind] = pr.first + lr;
    } else {
      pr = f(u, v, x[u] + l[u]);
      res[ind] = pr.first;
    }
    lx = pr.second;
    lr = res[ind];
    lu = u;
    lv = v;
  }
  for (int i = 0; i < q; i++) {
    printf("%d\n", res[i]);
  }
  return 0;
}
