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 <class C>
constexpr int sz(const C &c) {
  return int(c.size());
}
constexpr const char nl = '\n', sp = ' ';
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using i128 = __int128_t;
using ui128 = __uint128_t;
using T = long double;
constexpr const T EPS = 1e-9;
bool lt(T a, T b) { return a + EPS < b; }
bool le(T a, T b) { return !lt(b, a); }
bool gt(T a, T b) { return lt(b, a); }
bool ge(T a, T b) { return !lt(a, b); }
bool eq(T a, T b) { return !lt(a, b) && !lt(b, a); }
bool ne(T a, T b) { return lt(a, b) || lt(b, a); }
int sgn(T a) { return lt(a, 0) ? -1 : lt(0, a) ? 1 : 0; }
struct eps_lt {
  bool operator()(T a, T b) const { return lt(a, b); }
};
struct eps_le {
  bool operator()(T a, T b) const { return !lt(b, a); }
};
struct eps_gt {
  bool operator()(T a, T b) const { return lt(b, a); }
};
struct eps_ge {
  bool operator()(T a, T b) const { return !lt(a, b); }
};
struct eps_eq {
  bool operator()(T a, T b) const { return !lt(a, b) && !lt(b, a); }
};
struct eps_ne {
  bool operator()(T a, T b) const { return lt(a, b) || lt(b, a); }
};
using pt = complex<T>;
istream &operator>>(istream &stream, pt &p) {
  T X, Y;
  stream >> X >> Y;
  p = pt(X, Y);
  return stream;
}
ostream &operator<<(ostream &stream, const pt &p) {
  return stream << p.real() << ' ' << p.imag();
}
bool operator<(const pt &a, const pt &b) {
  return eq(a.real(), b.real()) ? lt(a.imag(), b.imag())
                                : lt(a.real(), b.real());
}
bool operator<=(const pt &a, const pt &b) { return !(b < a); }
bool operator>(const pt &a, const pt &b) { return b < a; }
bool operator>=(const pt &a, const pt &b) { return !(a < b); }
bool operator==(const pt &a, const pt &b) { return !(a < b) && !(b < a); }
bool operator!=(const pt &a, const pt &b) { return a < b || b < a; }
struct pt_lt {
  bool operator()(const pt &a, const pt &b) const { return a < b; }
};
struct pt_le {
  bool operator()(const pt &a, const pt &b) const { return !(b < a); }
};
struct pt_gt {
  bool operator()(const pt &a, const pt &b) const { return b < a; }
};
struct pt_ge {
  bool operator()(const pt &a, const pt &b) const { return !(a < b); }
};
struct pt_eq {
  bool operator()(const pt &a, const pt &b) const {
    return !(a < b) && !(b < a);
  }
};
struct pt_ne {
  bool operator()(const pt &a, const pt &b) const { return a < b || b < a; }
};
T dot(const pt &a, const pt &b) {
  return a.real() * b.real() + a.imag() * b.imag();
}
T cross(const pt &a, const pt &b) {
  return a.real() * b.imag() - a.imag() * b.real();
}
T norm(const pt &a) { return dot(a, a); }
T distSq(const pt &a, const pt &b) { return norm(b - a); }
T dist(const pt &a, const pt &b) { return abs(b - a); }
T ang(const pt &a, const pt &b) { return arg(b - a); }
T ang(const pt &a, const pt &b, const pt &c) {
  return remainder(ang(b, a) - ang(b, c), 2 * acos(T(-1)));
}
T area2(const pt &a, const pt &b, const pt &c) { return cross(b - a, c - a); }
int ccw(const pt &a, const pt &b, const pt &c) { return sgn(area2(a, b, c)); }
pt rot(const pt &a, const pt &p, T theta) {
  return (a - p) * pt(polar(T(1), theta)) + p;
}
pt perp(const pt &a) { return pt(-a.imag(), a.real()); }
struct Line {
  pt v;
  T c;
  Line(T a = 0, T b = 0, T c = 0) : v(b, -a), c(c) {}
  Line(const pt &v, T c) : v(v), c(c) {}
  Line(const pt &p, const pt &q) : v(q - p), c(cross(v, p)) {}
  T eval(const pt &p) const { return cross(v, p) - c; }
  int onLeft(const pt &p) const { return sgn(eval(p)); }
  T distSq(const pt &p) const {
    T e = eval(p);
    return e * e / norm(v);
  }
  T dist(const pt &p) const { return abs(eval(p) / abs(v)); }
  Line perpThrough(const pt &p) const { return Line(p, p + perp(v)); }
  Line translate(const pt &p) const { return Line(v, c + cross(v, p)); }
  Line shiftLeft(T d) const { return Line(v, c + d * abs(v)); }
  pt proj(const pt &p) const { return p - perp(v) * eval(p) / norm(v); }
  pt refl(const pt &p) const { return p - perp(v) * T(2) * eval(p) / norm(v); }
  int cmpProj(const pt &p, const pt &q) const {
    return sgn(dot(v, p) - dot(v, q));
  }
};
bool onSeg(const pt &p, const pt &a, const pt &b) {
  return !ccw(p, a, b) && !lt(0, dot(a - p, b - p));
}
int lineSegIntersects(const pt &a, const pt &b, const pt &p, const pt &q) {
  int o1 = ccw(a, b, p), o2 = ccw(a, b, q), o3 = ccw(p, q, a);
  int o4 = ccw(p, q, b);
  if (o1 != o2 && o3 != o4)
    return 1;
  else if ((!o1 && onSeg(p, a, b)) || (!o2 && onSeg(q, a, b)) ||
           (!o3 && onSeg(a, p, q)) || (!o4 && onSeg(b, p, q)))
    return 2;
  else
    return 0;
}
vector<pt> lineSegIntersection(const pt &a, const pt &b, const pt &p,
                               const pt &q) {
  int intersects = lineSegIntersects(a, b, p, q);
  if (!intersects)
    return vector<pt>();
  else if (intersects == 1) {
    T c1 = cross(p - a, b - a), c2 = cross(q - a, b - a);
    return vector<pt>{(c1 * q - c2 * p) / (c1 - c2)};
  }
  vector<pt> ret;
  if (onSeg(p, a, b)) ret.push_back(p);
  if (onSeg(q, a, b)) ret.push_back(q);
  if (onSeg(a, p, q)) ret.push_back(a);
  if (onSeg(b, p, q)) ret.push_back(b);
  sort(ret.begin(), ret.end(), pt_lt());
  ret.erase(unique(ret.begin(), ret.end(), pt_eq()), ret.end());
  return ret;
}
const bool FIRST = true, LAST = false;
template <const bool ISFIRST, class T, class F>
T bsearch(T lo, T hi, F f) {
  static_assert(is_integral<T>::value, "T must be integral");
  hi--;
  while (lo <= hi) {
    T mid = lo + (hi - lo) / 2;
    if (f(mid) == ISFIRST)
      hi = mid - 1;
    else
      lo = mid + 1;
  }
  return ISFIRST ? lo : hi;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  T SY, A, B;
  cin >> SY >> A >> B;
  int N;
  cin >> N;
  vector<pair<ll, ll>> segs(N);
  for (auto &&[l, r] : segs) cin >> l >> r;
  sort(segs.begin(), segs.end());
  vector<ll> sm(N, 0);
  for (int i = 0; i < N; i++) sm[i] = segs[i].second - segs[i].first;
  partial_sum(sm.begin(), sm.end(), sm.begin());
  auto rsq = [&](int l, int r) {
    if (l > r) return 0LL;
    return sm[r] - (l == 0 ? 0 : sm[l - 1]);
  };
  int Q;
  cin >> Q;
  pt left(A, SY), right(B, SY);
  for (int i = 0; i < Q; i++) {
    pt p;
    cin >> p;
    int l = bsearch<LAST>(0, N, [&](int k) {
      return Line(left, p).onLeft(pt(segs[k].first, 0)) > 0;
    });
    int r = bsearch<FIRST>(0, N, [&](int k) {
      return Line(right, p).onLeft(pt(segs[k].second, 0)) < 0;
    });
    T scale = (p.imag() - SY) / p.imag();
    T ans = rsq(l + 1, r - 1);
    if (l == r && 0 <= l && l < N) {
      vector<pt> interl =
          lineSegIntersection(left, p, segs[l].first, segs[l].second);
      vector<pt> interr =
          lineSegIntersection(right, p, segs[l].first, segs[l].second);
      T a = segs[l].first, b = segs[l].second;
      if (sz(interl) == 1) a = interl[0].real();
      if (sz(interr) == 1) b = interr[0].real();
      ans += b - a;
    } else {
      if (0 <= l && l < N) {
        vector<pt> inter =
            lineSegIntersection(left, p, segs[l].first, segs[l].second);
        if (sz(inter) == 1) ans += segs[l].second - inter[0].real();
      }
      if (0 <= r && r < N) {
        vector<pt> inter =
            lineSegIntersection(right, p, segs[r].first, segs[r].second);
        if (sz(inter) == 1) ans += inter[0].real() - segs[r].first;
      }
    }
    cout << fixed << setprecision(9) << ans * scale << nl;
  }
  return 0;
}