#include <bits/stdc++.h>
using namespace std;
const int NMAX = 300000;
const double eps = 1e-6;
double sy, a, b;
int n, q;
double L[NMAX], R[NMAX];
double sum[NMAX];
int dcmp(double x, double y) {
  if (fabs(x - y) < eps) return 0;
  if (x > y) return 1;
  return -1;
}
int bin_search(double x) {
  int l = 1, r = n, ret = 0;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (dcmp(x, R[mid]) >= 0) {
      ret = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  }
  return ret;
}
int main() {
  scanf("%lf%lf%lf", &sy, &a, &b);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf", &L[i], &R[i]);
    sum[i] = sum[i - 1] + R[i] - L[i];
  }
  scanf("%d", &q);
  while (q--) {
    double x0, y0, x1, x2;
    scanf("%lf%lf", &x0, &y0);
    if (dcmp(x0, a) == 0)
      x1 = a;
    else {
      double k = (y0 - sy) / (x0 - a);
      x1 = a - sy / k;
    }
    if (dcmp(x0, b) == 0)
      x2 = b;
    else {
      double k = (y0 - sy) / (x0 - b);
      x2 = b - sy / k;
    }
    int r1 = bin_search(x1);
    int r2 = bin_search(x2);
    double ans = (sum[r2] - sum[r1]);
    if (r1 + 1 <= n && dcmp(L[r1 + 1], x1) < 0) ans -= x1 - L[r1 + 1];
    if (r2 + 1 <= n && dcmp(L[r2 + 1], x2) < 0) ans += x2 - L[r2 + 1];
    printf("%.15lf\n", (b - a) * ans / (x2 - x1));
  }
  return 0;
}
