#include <bits/stdc++.h>
using namespace std;
int sy, a, b;
int n, q;
int l[200010];
int r[200010];
int sum[200100];
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  cin >> sy >> a >> b;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l[i] >> r[i];
    if (i) {
      sum[i] = sum[i - 1] + l[i] - r[i - 1];
    }
  }
  cin >> q;
  for (int i = 0; i < q; i++) {
    int x1, y1;
    cin >> x1 >> y1;
    int x2 = a, y2 = sy;
    int A = y2 - y1;
    long long C = 1ll * x2 * y1 - 1ll * x1 * y2;
    A *= -1, C *= -1;
    int lo = 0, hi = n;
    while (lo != hi) {
      int mi = (lo + hi) >> 1;
      if (-C <= 1ll * r[mi] * A)
        hi = mi;
      else
        lo = mi + 1;
    }
    int L = lo;
    x2 = b, y2 = sy;
    A = y2 - y1, C = 1ll * x2 * y1 - 1ll * x1 * y2;
    A *= -1, C *= -1;
    lo = -1, hi = n - 1;
    while (lo != hi) {
      int mi = (lo + hi + 1) >> 1;
      if (-C >= 1ll * l[mi] * A)
        lo = mi;
      else
        hi = mi - 1;
    }
    int R = hi;
    if (R == -1) {
      cout << 0.0 << '\n';
    } else if (L == n) {
      cout << 0.0 << '\n';
    } else {
      double mul = 1.0 * abs(sy - y1) / y1;
      double an = sum[R] - sum[L];
      an *= mul;
      x2 = a, y2 = sy;
      A = y2 - y1, C = 1ll * x2 * y1 - 1ll * x1 * y2;
      double x3 = -1.0 * C / A;
      if (x3 < l[L]) an += (1.0 * l[L] - x3) * mul;
      x2 = b, y2 = sy;
      A = y2 - y1, C = 1ll * x2 * y1 - 1ll * x1 * y2;
      x3 = -1.0 * C / A;
      if (r[R] < x3) an += (x3 - r[R]) * mul;
      cout << 1.0 * (b - a) - an << '\n';
    }
  }
}
