#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  bool t = false;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') t = true, ch = getchar();
  while (ch <= '9' && ch >= '0') x = x * 10 + ch - 48, ch = getchar();
  return t ? -x : x;
}
double Sy, A, B, L[200200], R[200200], p[200200];
int n, q;
int main() {
  Sy = read();
  A = read();
  B = read();
  n = read();
  for (int i = 1; i <= n; ++i) L[i] = read(), R[i] = read();
  for (int i = 1; i <= n; ++i) p[i] = p[i - 1] + R[i] - L[i];
  q = read();
  while (q--) {
    double x = read(), y = read();
    double xl = A + (x - A) * (-Sy) / (y - Sy);
    double xr = B + (x - B) * (-Sy) / (y - Sy);
    int x1 = upper_bound(&L[1], &L[n + 1], xl) - L - 1;
    int x2 = upper_bound(&L[1], &L[n + 1], xr) - L - 1;
    double lf = 0, rt = 0;
    if (x1) lf = p[x1 - 1] + min(R[x1], xl) - L[x1];
    if (x2) rt = p[x2 - 1] + min(R[x2], xr) - L[x2];
    printf("%.10lf\n", (rt - lf) * (y - Sy) / y);
  }
  return 0;
}
