#include <bits/stdc++.h>
using namespace std;
bool cmp(const pair<pair<int, int>, pair<int, int> >& a,
         const pair<pair<int, int>, pair<int, int> >& b) {
  return a.second.first < b.second.first;
}
const int M = 1ll << 30;
struct Node {
  Node() {
    sum = 0;
    cov = 0;
    sons[0] = sons[1] = nullptr;
  }
  Node* sons[2];
  int sum, cov;
  void Check(int ind) {
    if (sons[ind] != nullptr) {
      return;
    }
    sons[ind] = new Node();
  }
  void AddRec(int l, int r, int b_l, int b_r, int val) {
    if (r < b_l || l > b_r) {
      return;
    }
    int wid = b_r - b_l + 1;
    if (wid > 1) {
      for (auto tr = (0); tr <= ((2) - 1); ++tr) {
        Check(tr);
      }
    }
    int m;
    if (r >= b_r && l <= b_l) {
      sum += val;
      if (wid == 1) {
        cov = wid * !!sum;
      } else {
        goto B;
      }
      return;
    }
    m = (b_l + b_r) / 2;
    sons[0]->AddRec(l, r, b_l, m, val);
    sons[1]->AddRec(l, r, m + 1, b_r, val);
  B:;
    if (sum) {
      cov = wid;
    } else {
      cov = sons[0]->cov + sons[1]->cov;
    }
  }
  int ReadRec(int l, int r, int b_l, int b_r, int up) {
    if (r < b_l || l > b_r) {
      return 0;
    }
    int wid = b_r - b_l + 1;
    if (wid > 1) {
      for (auto tr = (0); tr <= ((2) - 1); ++tr) {
        Check(tr);
      }
    }
    if (r >= b_r && l <= b_l) {
      if (up + sum) {
        return wid;
      }
      return cov;
    }
    int heh = 0;
    int m = (b_l + b_r) / 2;
    heh += sons[0]->ReadRec(l, r, b_l, m, up | (!!sum));
    heh += sons[1]->ReadRec(l, r, m + 1, b_r, up | (!!sum));
    return heh;
  }
  void Free() {
    for (auto tr = (0); tr <= ((2) - 1); ++tr) {
      if (sons[tr] != nullptr) {
        sons[tr]->Free();
        delete sons[tr];
      }
    }
  }
};
struct DynamicTree {
  Node* root;
  DynamicTree() { root = new Node(); }
  ~DynamicTree() {
    root->Free();
    delete root;
  }
  void Add(int l, int r, int val) { root->AddRec(l, r, 1, M, val); }
  int ReadCov(int l, int r) { return root->ReadRec(l, r, 1, M, 0); }
};
struct Ev {
  int x, y1, y2, val;
  bool operator<(const Ev& e) const {
    if (x != e.x) {
      return x < e.x;
    }
    return val < e.val;
  }
};
pair<pair<int, int>, pair<int, int> > query[200005];
pair<int, int> tab[200005];
void jebaj() {
  DynamicTree t;
  long long n;
  cin >> n;
  for (auto i = (0); i <= ((n)-1); ++i) {
    cin >> tab[i].first >> tab[i].second;
  }
  long long q;
  cin >> q;
  for (auto i = (0); i <= ((q)-1); ++i) {
    cin >> query[i].first.first >> query[i].first.second;
    query[i].first.first--;
    query[i].first.second--;
    query[i].second.first = i;
  }
  sort(query, query + q);
  long long pocz = query[q - 1].first.first, kon = query[q - 1].first.second;
  for (auto j = (n - 1); j >= (pocz); --j) {
    t.Add(tab[j].first, tab[j].first + tab[j].second - 1, 1ll);
  }
  for (auto i = (q - 1); i >= (0); --i) {
    for (auto j = (query[i].first.first); j <= (pocz - 1); ++j)
      t.Add(tab[j].first, tab[j].first + tab[j].second - 1, 1LL);
    pocz = query[i].first.first;
    long long a = query[i].first.first, b = query[i].first.second;
    long long res =
        tab[b].first - tab[a].first - t.ReadCov(tab[a].first, tab[b].first - 1);
    query[i].second.second = res;
  }
  sort(query, query + q, cmp);
  for (auto i = (0); i <= ((q)-1); ++i) {
    cout << query[i].second.second << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int t;
  t = 1;
  for (auto i = (0); i <= ((t)-1); ++i) {
    jebaj();
  }
}
