#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
double solve(double x, double y, double ax, double ay) {
  return y / (y - ay) * (ax - x) + x;
}
int n2;
int a[N << 1], sum[N << 1];
int bin(int x) {
  int l = 0, r = n2;
  while (l < r) {
    int mid = (l + r + 1) >> 1;
    if (a[mid] > x)
      r = mid - 1;
    else
      l = mid;
  }
  return l;
}
int main() {
  int sy, ax, bx, ll, rr, dl, dr, ans, T, n, x, y;
  double l, r, res;
  scanf("%d%d%d", &sy, &ax, &bx);
  scanf("%d", &n);
  n2 = n * 2;
  for (int i = 1; i <= n2; i += 2) scanf("%d%d", &a[i], &a[i + 1]);
  sum[0] = 0;
  for (int i = 1; i <= n2; i++) {
    if (i & 1)
      sum[i] = sum[i - 1];
    else
      sum[i] = sum[i - 1] + a[i] - a[i - 1];
  }
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d", &x, &y);
    l = solve((double)x, (double)y, (double)ax, (double)sy);
    r = solve((double)x, (double)y, (double)bx, (double)sy);
    ll = int(l);
    rr = int(r);
    dl = bin(ll);
    dr = bin(rr);
    ans = sum[dr] - sum[dl];
    res = 0.0;
    if (dl & 1) {
      res -= l - (double)ll;
      ans -= ll - a[dl];
    }
    if (dr & 1) {
      res += r - (double)rr;
      ans += rr - a[dr];
    }
    res += (double)ans;
    res = res * ((double)bx - (double)(ax)) / (r - l);
    printf("%.15f\n", res);
  }
}
