#include <bits/stdc++.h>
using namespace std;
const int N_ = 2E5 + 3;
double k;
int sy, X, Y;
int sum[N_], nBarrier, nPoint;
int pointfst[N_], pointsnd[N_], barrierfst[N_], barriersnd[N_];
void enter() {
  scanf("%d%d%d%d", &sy, &X, &Y, &nBarrier);
  for (int i = 1; i <= nBarrier; ++i)
    scanf("%d%d", &barrierfst[i], &barriersnd[i]);
  scanf("%d", &nPoint);
  for (int i = 1; i <= nPoint; ++i) scanf("%d%d", &pointfst[i], &pointsnd[i]);
}
double findIntersect(double x1, double afkajsdfkjkjkkk, double x2, double y2) {
  double c = (afkajsdfkjkjkkk - y2) * x1 + (x2 - x1) * afkajsdfkjkjkkk;
  double a = (afkajsdfkjkjkkk - y2);
  return c / a;
}
inline double dist(double x1, double afkajsdfkjkjkkk, double x2, double y2) {
  return sqrt((x2 - x1) * (x2 - x1) +
              (y2 - afkajsdfkjkjkkk) * (y2 - afkajsdfkjkjkkk));
}
void prep() {
  for (int i = 1; i <= nBarrier; ++i)
    sum[i] = sum[i - 1] + barriersnd[i] - barrierfst[i];
}
inline double findK(double pt, int humanfst, int humansnd) {
  double a = dist((double)humanfst, (double)humansnd, pt, 0);
  double b = dist((double)humanfst, (double)humansnd, (double)X, (double)sy);
  return a / b;
}
int binarySearchLeft(double &intersectPoint) {
  if (barriersnd[nBarrier] <= intersectPoint) return -1;
  int l = 1, r = nBarrier, mid, ret = -1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (barriersnd[mid] > intersectPoint) {
      r = mid - 1;
      ret = mid;
    } else
      l = mid + 1;
  }
  return ret;
}
int binarySearchRight(double &intersectPoint) {
  if (barrierfst[1] >= intersectPoint) return -1;
  int l = 1, r = nBarrier, mid, ret = -1;
  while (l <= r) {
    mid = (l + r) / 2;
    if (barrierfst[mid] < intersectPoint) {
      l = mid + 1;
      ret = mid;
    } else
      r = mid - 1;
  }
  return ret;
}
void solve() {
  for (int i = 1; i <= nPoint; ++i) {
    double lPoint =
        findIntersect(X, sy, (double)pointfst[i], (double)pointsnd[i]);
    double rPoint =
        findIntersect(Y, sy, (double)pointfst[i], (double)pointsnd[i]);
    int lBarrier = binarySearchLeft(lPoint);
    int rBarrier = binarySearchRight(rPoint);
    if (lBarrier == -1 || rBarrier == -1 || lBarrier > rBarrier) {
      printf("0.000000\n");
      continue;
    }
    k = findK(lPoint, pointfst[i], pointsnd[i]);
    lPoint = max(lPoint, (double)barrierfst[lBarrier]);
    rPoint = min(rPoint, (double)barriersnd[rBarrier]);
    double lLeak = abs(lPoint - (double)barrierfst[lBarrier]);
    double rLeak = abs(rPoint - (double)barriersnd[rBarrier]);
    printf("%.6f\n",
           ((double)sum[rBarrier] - (double)sum[lBarrier - 1] - lLeak - rLeak) /
               k);
  }
}
int main() {
  enter();
  prep();
  solve();
  return 0;
}
