#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
int n, m;
double arr[N], barr[N];
double sy, a, b, x, y, xl, xr;
int main() {
  scanf("%lf %lf %lf", &sy, &a, &b);
  scanf("%d ", &n);
  double sum[N];
  sum[0] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lf %lf", &arr[i], &barr[i]);
    sum[i] = sum[i - 1] + barr[i] - arr[i];
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    scanf("%lf %lf", &x, &y);
    xl = x + (x - a) * (-y) / (y - sy);
    xr = x + (x - b) * (-y) / (y - sy);
    int x1 = lower_bound(arr + 1, arr + n + 1, xl) - arr - 1;
    int x2 = lower_bound(arr + 1, arr + n + 1, xr) - arr - 1;
    double lf = 0, rt = 0;
    if (x1) lf = sum[x1 - 1] + min(barr[x1], xl) - arr[x1];
    if (x2) rt = sum[x2 - 1] + min(barr[x2], xr) - arr[x2];
    printf("%.101f\n", (rt - lf) * (y - sy) / y);
  }
  return 0;
}
