#include <bits/stdc++.h>
using namespace std;
struct chash {
  long long operator()(long long x) const { return hash<long long>{}(x); }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long sy, a, b;
  cin >> sy >> a >> b;
  long long n;
  cin >> n;
  long long X[n], Y[n];
  long long sum[n];
  for (long long i = 0; i < n; i++) cin >> X[i] >> Y[i], sum[i] = Y[i] - X[i];
  for (long long i = 1; i < n; i += 1) sum[i] += sum[i - 1];
  long long q;
  cin >> q;
  cout << setprecision(6) << fixed;
  while (q--) {
    long long x, y;
    cin >> x >> y;
    long double x1 = x + (1.0 * y * (x - a) / (sy - y));
    long double x2 = x + (1.0 * y * (x - b) / (sy - y));
    long long l1 = lower_bound(Y, Y + n, x1) - Y;
    long long l2 = lower_bound(Y, Y + n, x2) - Y;
    long double left = 0, right = 0;
    left =
        ((l1 - 1) >= 0 ? sum[l1 - 1] : 0) +
        ((l1 < n) ? min((long double)Y[l1], max(x1, (long double)X[l1])) - X[l1]
                  : 0);
    right =
        ((l2 - 1) >= 0 ? sum[l2 - 1] : 0) +
        ((l2 < n) ? min((long double)Y[l2], max(x2, (long double)X[l2])) - X[l2]
                  : 0);
    cout << ((right - left) * ((long double)(y - sy) / (y))) << "\n";
  }
  return 0;
}
