Problem: There is a light source on the plane. This source is so small that it can be represented as point. The light source is moving from point (a, s_y) to the (b, s_y) (s_y < 0) with speed equal to 1 unit per second. The trajectory of this light source is a straight segment connecting these two points. 

There is also a fence on OX axis represented as n segments (l_i, r_i) (so the actual coordinates of endpoints of each segment are (l_i, 0) and (r_i, 0)). The point (x, y) is in the shade if segment connecting (x,y) and the current position of the light source intersects or touches with any segment of the fence.

<image>

You are given q points. For each point calculate total time of this point being in the shade, while the light source is moving from (a, s_y) to the (b, s_y).

Input

First line contains three space separated integers s_y, a and b (-10^9 ≤ s_y < 0, 1 ≤ a < b ≤ 10^9) — corresponding coordinates of the light source.

Second line contains single integer n (1 ≤ n ≤ 2 ⋅ 10^5) — number of segments in the fence.

Next n lines contain two integers per line: l_i and r_i (1 ≤ l_i < r_i ≤ 10^9, r_{i - 1} < l_i) — segments in the fence in increasing order. Segments don't intersect or touch each other.

Next line contains single integer q (1 ≤ q ≤ 2 ⋅ 10^5) — number of points to check.

Next q lines contain two integers per line: x_i and y_i (1 ≤ x_i, y_i ≤ 10^9) — points to process.

Output

Print q lines. The i-th line should contain one real number — total time of the i-th point being in the shade, while the light source is moving from (a, s_y) to the (b, s_y). The answer is considered as correct if its absolute of relative error doesn't exceed 10^{-6}.

Example

Input

-3 1 6
2
2 4
6 7
5
3 1
1 3
6 1
6 4
7 6


Output

5.000000000000000
3.000000000000000
0.000000000000000
1.500000000000000
2.000000000000000

Note

  * The 1-st point is always in the shade; 
  * the 2-nd point is in the shade while light source is moving from (3, -3) to (6, -3); 
  * the 3-rd point is in the shade while light source is at point (6, -3). 
  * the 4-th point is in the shade while light source is moving from (1, -3) to (2.5, -3) and at point (6, -3); 
  * the 5-th point is in the shade while light source is moving from (1, -3) to (2.5, -3) and from (5.5, -3) to (6, -3); 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline void chkmin(T1 &x, T2 y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
inline void chkmax(T1 &x, T2 y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const pair<T, U> &_p) {
  _out << _p.first << ' ' << _p.second;
  return _out;
}
template <typename T, typename U>
inline istream &operator>>(istream &_in, pair<T, U> &_p) {
  _in >> _p.first >> _p.second;
  return _in;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const vector<T> &_v) {
  if (_v.empty()) {
    return _out;
  }
  _out << _v.front();
  for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline istream &operator>>(istream &_in, vector<T> &_v) {
  for (auto &_i : _v) {
    _in >> _i;
  }
  return _in;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const set<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const multiset<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const unordered_set<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T>
inline ostream &operator<<(ostream &_out, const unordered_multiset<T> &_s) {
  if (_s.empty()) {
    return _out;
  }
  _out << *_s.begin();
  for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) {
    _out << ' ' << *_it;
  }
  return _out;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const map<T, U> &_m) {
  if (_m.empty()) {
    return _out;
  }
  _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')';
  for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) {
    _out << ", (" << _it->first << ": " << _it->second << ')';
  }
  return _out;
}
template <typename T, typename U>
inline ostream &operator<<(ostream &_out, const unordered_map<T, U> &_m) {
  if (_m.empty()) {
    return _out;
  }
  _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')';
  for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) {
    _out << ", (" << _it->first << ": " << _it->second << ')';
  }
  return _out;
}
const string FILENAME = "input";
const int MAXN = 200228;
struct point {
  int x, y;
  point() {}
  point(int _x, int _y) {
    x = _x;
    y = _y;
  }
};
point a, b;
int n;
int l[MAXN], r[MAXN];
point c[MAXN];
double sum[MAXN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> a.y >> a.x >> b.x;
  b.y = a.y;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> c[i].x >> c[i].y;
  }
  for (int i = 0; i < n; i++) {
    sum[i] = r[i] - l[i];
    if (i) {
      sum[i] += sum[i - 1];
    }
  }
  for (int i = 0; i < q; i++) {
    int ll = 0;
    int rr = n - 1;
    while (ll != rr) {
      int mid = (ll + rr) >> 1;
      double pos = double(-a.y + c[i].y) / c[i].y * (r[mid] - c[i].x) + c[i].x;
      if (pos < a.x) {
        ll = mid + 1;
      } else {
        rr = mid;
      }
    }
    double pos = double(-a.y + c[i].y) / c[i].y * (r[ll] - c[i].x) + c[i].x;
    if (pos < a.x) {
      cout << 0 << '\n';
      continue;
    }
    int left228 = ll;
    rr = n - 1;
    while (ll != rr) {
      int mid = (ll + rr + 1) >> 1;
      double pos = c[i].x - double(-a.y + c[i].y) / c[i].y * (c[i].x - l[mid]);
      if (pos > b.x) {
        rr = mid - 1;
      } else {
        ll = mid;
      }
    }
    int right228 = rr;
    double posr =
        double(-a.y + c[i].y) / c[i].y * (r[left228] - c[i].x) + c[i].x;
    double posl =
        c[i].x - double(-a.y + c[i].y) / c[i].y * (c[i].x - l[left228]);
    chkmax(posl, a.x);
    chkmin(posr, b.x);
    double ans = max(0.0, posr - posl);
    if (left228 != right228) {
      posr = double(-a.y + c[i].y) / c[i].y * (r[right228] - c[i].x) + c[i].x;
      posl = c[i].x - double(-a.y + c[i].y) / c[i].y * (c[i].x - l[right228]);
      chkmax(posl, a.x);
      chkmin(posr, b.x);
      ans += max(0.0, posr - posl);
    }
    left228++;
    right228--;
    if (left228 <= right228) {
      double len = sum[right228] - sum[left228 - 1];
      len *= double(-a.y + c[i].y) / c[i].y;
      ans += len;
    }
    cout << fixed << ans << '\n';
  }
  return 0;
}