#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const double eps = 1e-9, INF = 0x3f3f3f3f;
double sy, a, b, sum[maxn], l[maxn], r[maxn];
int n, q;
inline void init() {
  scanf("%lf%lf%lf", &sy, &a, &b);
  scanf("%d", &n);
  n++;
  l[1] = r[1] = 0;
  for (int i = 2; i <= n; i++) {
    scanf("%lf%lf", &l[i], &r[i]);
    sum[i] = sum[i - 1] + (r[i] - l[i]);
  }
  ++n;
  l[n] = r[n] = INF;
  sum[n] = sum[n - 1];
}
inline void solve() {
  scanf("%d", &q);
  while (q--) {
    double x, y;
    scanf("%lf%lf", &x, &y);
    double sfb = y / (y - sy);
    double pax = a - x, pbx = b - x;
    pax *= sfb;
    pbx *= sfb;
    pax += x;
    pbx += x;
    if (pbx <= l[1] || pax >= r[n]) {
      printf("0.00000000\n");
      continue;
    }
    double ans = 0;
    int L = 1, R = n;
    while (L < R) {
      int mid = (L + R + 1) >> 1;
      if (l[mid] <= pax)
        L = mid;
      else
        R = mid - 1;
    }
    ans -= sum[L] - max(0.0, r[L] - pax);
    L = 1, R = n;
    while (L < R) {
      int mid = (L + R) >> 1;
      if (r[mid] >= pbx)
        R = mid;
      else
        L = mid + 1;
    }
    ans += sum[R];
    ans -= min(r[L] - pbx, r[L] - l[L]);
    ans = ans / sfb;
    printf("%.7f\n", ans);
  }
}
int main() {
  init();
  solve();
  return 0;
}
