#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
long long L[MAXN], R[MAXN], S[MAXN];
const double eps = 1e-6, inf = 1e15;
int main() {
  long long sy, a, b;
  scanf("%lld%lld%lld", &sy, &a, &b);
  int N;
  scanf("%d", &N);
  L[0] = R[0] = 0;
  L[N + 1] = R[N + 1] = inf;
  for (int i = 1; i <= N; ++i) scanf("%lld%lld", &L[i], &R[i]);
  S[0] = 0;
  for (int i = 1; i <= N; ++i) S[i] = S[i - 1] + R[i] - L[i];
  int Q;
  scanf("%d", &Q);
  while (Q--) {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    double x_a = a + double(x - a) / double(sy - y) * sy,
           x_b = b + double(x - b) / double(sy - y) * sy;
    int l = 0, r = N + 1;
    while (l != r) {
      int m = (l + r + 1) / 2;
      if (L[m] <= x_a + eps)
        l = m;
      else
        r = m - 1;
    }
    int i = l;
    l = 0, r = N + 1;
    while (l != r) {
      int m = (l + r) / 2;
      if (R[m] >= x_b - eps)
        r = m;
      else
        l = m + 1;
    }
    int j = r;
    double ans = 0.0;
    if (i == j)
      ans = x_b - x_a;
    else
      ans = S[j - 1] - S[i] + max(0.0, R[i] - x_a) + max(0.0, x_b - L[j]);
    printf("%.10f\n", ans * (double(y - sy) / y));
  }
  return 0;
}
