#include <bits/stdc++.h>
using namespace std;
struct node {
  int val;
  bool prop;
  node *lft, *rht;
  node(int l, int r) {
    prop = 0;
    val = r - l + 1;
    lft = NULL;
    rht = NULL;
  }
};
void propagate(node *root, int l, int r) {
  if (!root->prop || l == r) return;
  int mid = (l + r) >> 1;
  if (!root->lft) root->lft = new node(l, mid);
  if (!root->rht) root->rht = new node(mid + 1, r);
  if (root->lft->val != 0) {
    root->lft->val = 0;
    root->lft->prop = 1;
  }
  if (root->rht->val != 0) {
    root->rht->val = 0;
    root->rht->prop = 1;
  }
  root->prop = 0;
}
void update(node *root, int l, int r, int L, int R) {
  if (r < L || R < l) return;
  if (root->val == 0) return;
  if (L <= l && r <= R) {
    root->val = 0;
    root->prop = 1;
    return;
  }
  int mid = (l + r) >> 1;
  if (!root->lft) root->lft = new node(l, mid);
  if (!root->rht) root->rht = new node(mid + 1, r);
  update(root->lft, l, mid, L, R);
  update(root->rht, mid + 1, r, L, R);
  root->val = root->lft->val + root->rht->val;
}
long long query(node *root, int l, int r, int L, int R) {
  if (r < L || R < l || root->val == 0) return 0;
  propagate(root, l, r);
  if (L <= l && r <= R) return root->val;
  int mid = (l + r) >> 1;
  if (!root->lft) root->lft = new node(l, mid);
  if (!root->rht) root->rht = new node(mid + 1, r);
  return query(root->lft, l, mid, L, R) + query(root->rht, mid + 1, r, L, R);
}
node *root = new node(1, 1000000002);
int h[201000], x[201000], ans[201000];
vector<pair<int, int> > Query[201000];
int main() {
  int n, q, l, r;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &x[i], &h[i]);
  scanf("%d", &q);
  for (int i = 1; i <= q; ++i) {
    scanf("%d%d", &l, &r);
    Query[l].push_back({r, i});
  }
  for (int i = n; i > 0; --i) {
    update(root, 1, 1000000002, x[i], min(x[i] + h[i] - 1, int(1000000002)));
    for (auto it : Query[i])
      ans[it.second] = query(root, 1, 1000000002, x[i], x[it.first] - 1);
  }
  for (int i = 1; i <= q; ++i) printf("%d\n", ans[i]);
  return 0;
}
