#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 7;
int n, sy, a, b, l[maxn], r[maxn], q;
double sum[maxn];
int find(double tar) {
  int L = 0, R = n + 1, mid;
  while (L + 1 < R) {
    mid = L + R >> 1;
    if (l[mid] < tar)
      L = mid;
    else
      R = mid;
  }
  return L;
}
inline double ip(double x1, double y1, double x2, double y2) {
  return x1 + (x1 - x2) * (-y1) / (y1 - y2);
}
double cal(int x, int y) {
  double p1 = ip(a, sy, x, y), p2 = ip(b, sy, x, y);
  int pp1 = find(p1), pp2 = find(p2);
  double ret = sum[pp2] - sum[pp1];
  if (p1 < r[pp1]) ret += r[pp1] - p1;
  if (p2 < r[pp2]) ret += p2 - r[pp2];
  return ret / (p2 - p1) * (b - a);
}
int main() {
  scanf("%d%d%d%d", &sy, &a, &b, &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &l[i], &r[i]);
  }
  for (int i = 1; i <= n; ++i) sum[i] = sum[i - 1] + r[i] - l[i];
  cin >> q;
  for (int i = 1, x, y; i <= q; ++i) {
    scanf("%d%d", &x, &y);
    printf("%lf\n", cal(x, y));
  }
  return 0;
}
