#include <bits/stdc++.h>
const int N = 1000005;
const double eps = 1e-9;
int n, m, a[N], b[N], ans, Q;
double l[N], r[N], sum[N];
int main() {
  register int sy, i, u, v;
  register double x, y, a, b;
  scanf("%d%d%d%d", &sy, &u, &v, &n), a = u, b = v;
  for (i = 1; i <= n; ++i)
    scanf("%d%d", &u, &v), l[i] = u, r[i] = v,
                           sum[i] = sum[i - 1] + r[i] - l[i];
  scanf("%d", &Q);
  while (Q--) {
    scanf("%d%d", &u, &v), x = u, y = v;
    const double p = (x * sy - a * y) / (sy - y),
                 q = (x * sy - b * y) / (sy - y);
    u = std::lower_bound(l + 1, l + 1 + n, p) - l,
    v = std::upper_bound(r + 1, r + 1 + n, q) - r - 1;
    register double s = sum[v] - sum[u - 1];
    if (u > 1 && r[u - 1] >= p) s += r[u - 1] - p;
    if (v < n && l[v + 1] <= q) s += q - l[v + 1];
    s < eps ? puts("0.000000000") : printf("%.9f\n", (b - a) * s / (q - p));
  }
  return 0;
}
