#include <bits/stdc++.h>
using namespace std;
inline int Gcd(int X, int Y) { return Y ? Gcd(Y, X % Y) : X; }
inline long long Gcd(long long X, long long Y) { return Y ? Gcd(Y, X % Y) : X; }
inline int Pow(int base, long long exp, int _mod) {
  if (!(base %= _mod)) return 0;
  int _ans = 1;
  for (; exp; exp >>= 1, base = (long long)base * base % _mod)
    exp& 1 ? _ans = (long long)_ans * base % _mod : 0;
  return _ans;
}
inline long long Pow(long long base, long long exp, long long _mod) {
  if (!(base %= _mod)) return 0;
  long long _ans = 1;
  for (; exp; exp >>= 1, base = base * base % _mod)
    exp& 1 ? _ans = _ans * base % _mod : 0;
  return _ans;
}
const int INF = 0x3f3f3f3f;
int sy, a, b, n, q;
int C[400005], S[400005];
double c[400005];
int main() {
  scanf("%d%d%d%d", &sy, &a, &b, &n);
  for (int i = 1; i <= (n); ++i)
    scanf("%d%d", C + i + i - 1, C + i + i),
        c[i + i - 1] = C[i + i - 1], c[i + i] = C[i + i],
                  S[i + i - 1] = S[i + i - 2],
                  S[i + i] = S[i + i - 1] + C[i + i] - C[i + i - 1];
  scanf("%d", &q);
  for (int i = 1; i <= (q); ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    double xl = a + (double)(x - a) * (-sy) / (y - sy);
    double xr = b + (double)(x - b) * (-sy) / (y - sy);
    int pl = lower_bound(c + 1, c + n + n + 1, xl) - c;
    int pr = upper_bound(c + 1, c + n + n + 1, xr) - c - 1;
    if (pr < pl) {
      printf("%.15lf\n", (double)(pl & 1 ? 0 : b - a));
      continue;
    }
    double dl = xr - xl, s = S[pr] - S[pl];
    if (~pl & 1) s += C[pl] - xl;
    if (pr & 1) s += xr - C[pr];
    printf("%.15lf\n", s * (b - a) / dl);
  }
  return 0;
}
