#include <bits/stdc++.h>
using namespace std;
const int maxn = 400005;
int n, N, q;
double f[maxn], sy, a, b;
double psum[maxn];
int main() {
  scanf("%lf%lf%lf%d", &sy, &a, &b, &n);
  N = n << 1;
  for (int i = 1; i <= N; ++i) scanf("%lf", f + i);
  psum[0] = 0.0;
  for (int i = 2; i <= N; i += 2)
    psum[i] = psum[i - 2] + f[i] - f[i - 1], psum[i - 1] = psum[i - 2];
  psum[N + 1] = psum[N];
  scanf("%d", &q);
  while (q--) {
    double x, y;
    scanf("%lf%lf", &x, &y);
    double x1 = (a * y - x * sy) / (y - sy), x2 = (b * y - x * sy) / (y - sy);
    double full = x2 - x1;
    int l, r;
    l = lower_bound(f + 1, f + N + 1, x1) - f;
    r = lower_bound(f + 1, f + N + 1, x2) - f;
    double fence = psum[r] - psum[l];
    if (l % 2 == 0) fence += f[l] - x1;
    if (r % 2 == 0) fence -= f[r] - x2;
    printf("%0.10lf\n", fence / full * (b - a));
  }
  return 0;
}
