#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
vector<pair<int, int> > v;
struct Node {
  Node *left, *right;
  int val;
  int lazy;
  Node() {
    left = right = NULL;
    val = 0;
    lazy = 0;
  }
};
inline void refresh(Node*& root, int x, int y) {
  if (root->lazy != 0 && root->val != (y - x + 1)) {
    root->val = 1LL * (y - x + 1) * root->lazy;
    if (x == y) {
      root->lazy = 0;
      return;
    }
    if (root->left == NULL) {
      root->left = new Node();
    }
    if (root->right == NULL) {
      root->right = new Node();
    }
    root->left->lazy = root->lazy;
    root->right->lazy = root->lazy;
    root->lazy = 0;
  }
}
inline void update(Node*& root, int x, int y, int b, int e, int val) {
  refresh(root, x, y);
  if (x > e || y < b || (root->val == y - x + 1)) {
    return;
  }
  int mid = (x + y) / 2;
  if (x >= b && y <= e) {
    root->lazy = val;
    refresh(root, x, y);
    return;
  }
  if (root->left == NULL) {
    root->left = new Node();
  }
  if (root->right == NULL) {
    root->right = new Node();
  }
  update(root->left, x, mid, b, e, val);
  update(root->right, mid + 1, y, b, e, val);
  root->val = root->left->val + root->right->val;
}
int query(Node*& root, int x, int y, int b, int e) {
  if (root == NULL || x > e || y < b) {
    return 0;
  }
  refresh(root, x, y);
  if (x >= b && y <= e) {
    return root->val;
  }
  int mid = (x + y) / 2;
  int L = query(root->left, x, mid, b, e);
  int R = query(root->right, mid + 1, y, b, e);
  return L + R;
}
vector<pair<int, int> > Q[N];
int ans[N];
int main() {
  Node* root = new Node();
  int n;
  scanf("%d", &n);
  ;
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d", &x);
    ;
    scanf("%d", &y);
    ;
    v.push_back(make_pair(x, y));
  }
  int q;
  scanf("%d", &q);
  ;
  for (int i = 0; i < q; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    Q[x].push_back(make_pair(y, i));
  }
  for (int i = v.size() - 1; i >= 0; i--) {
    update(root, 1, 1000000007, v[i].first,
           min(v[i].first + v[i].second - 1, 1000000007), 1);
    for (auto x : Q[i + 1]) {
      int a = i;
      int b = x.first;
      int len = v[b - 1].first - v[a].first;
      ans[x.second] =
          len - query(root, 1, 1000000007, v[a].first, v[b - 1].first - 1);
    }
  }
  int y;
  for (int i = 0; i < q; i++) {
    printf("%d\n", ans[i]);
  }
}
