#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const double eps = 1e-10, inf = 1e9;
double s, a, b, x, y, L[maxn], R[maxn], f[maxn], ans;
int main() {
  int n, q;
  scanf("%lf%lf%lf", &s, &a, &b);
  cin >> n;
  L[1] = R[1] = 0, ++n;
  for (register int i = 2; i <= n; ++i)
    scanf("%lf%lf", &L[i], &R[i]), f[i] = f[i - 1] + R[i] - L[i];
  ++n;
  L[n] = R[n] = inf;
  f[n] = f[n - 1];
  cin >> q;
  while (q--) {
    scanf("%lf%lf", &x, &y);
    double u = (a - x) / (y - s) * y + x, v = (b - x) / (y - s) * y + x;
    if (v <= L[1] || u >= R[n])
      printf("0.000000000\n");
    else {
      int l = 0, r = n;
      while (l < r) {
        int mid = (l + r + 1) >> 1;
        if (L[mid] <= u)
          l = mid;
        else
          r = mid - 1;
      }
      ans = max(0.0, R[l] - u) - f[l];
      l = 0, r = n;
      while (l < r) {
        int mid = (l + r) >> 1;
        if (R[mid] >= v)
          r = mid;
        else
          l = mid + 1;
      }
      ans += f[r];
      ans -= min(R[l] - v, R[l] - L[l]);
      ans *= (b - a) / (v - u);
      printf("%.7lf\n", ans);
    }
  }
  return 0;
}
