#include <bits/stdc++.h>
const int MAXN = 200100;
double seq[MAXN];
int l[MAXN], r[MAXN];
int main() {
  int sy, a, b, x, y, n, q;
  scanf("%d%d%d", &sy, &a, &b);
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d%d", l + i, r + i);
  std::sort(l + 1, l + n + 1);
  std::sort(r + 1, r + n + 1);
  seq[0] = 0.0;
  for (int i = 1; i <= n; ++i) seq[i] = seq[i - 1] + r[i] - l[i];
  seq[n + 1] = seq[n];
  scanf("%d", &q);
  while (q--) {
    double ax, bx;
    scanf("%d%d", &x, &y);
    if (x == a)
      ax = a;
    else {
      double k = 1.0 * (y - sy) / (x - a);
      ax = -sy / k + a;
    }
    if (x == b)
      bx = b;
    else {
      double k = 1.0 * (y - sy) / (x - b);
      bx = -sy / k + b;
    }
    int idx_a = std::lower_bound(l + 1, l + n + 1, ax) - l,
        idx_b = std::lower_bound(l + 1, l + n + 1, bx) - l;
    double ans = seq[idx_b - 1] - seq[idx_a - 1];
    if (idx_a - 1 && ax < r[idx_a - 1]) ans += r[idx_a - 1] - ax;
    if (idx_b - 1 && bx < r[idx_b - 1]) ans -= r[idx_b - 1] - bx;
    ans = ans / (bx - ax) * (b - a);
    printf("%.10f\n", ans);
  }
  return 0;
}
