#include <bits/stdc++.h>
using namespace std;
int n, q;
vector<int> l, r, x, y;
vector<long long> sum;
double ans(int x1, int y1, int x, int y) {
  long long a = y1 - y;
  long long b = x - x1;
  long long c = -a * x - b * y;
  double xs = -1.0 * c / a;
  int ll = 0, rr = n - 1;
  while (ll <= rr) {
    int md = (ll + rr) / 2;
    if (r[md] < xs)
      ll = md + 1;
    else
      rr = md - 1;
  }
  if (ll == n) return sum[n - 1];
  double ans = 0;
  if (ll != 0) ans = sum[ll - 1];
  if (l[ll] < xs) ans += xs - l[ll];
  return ans;
}
int main() {
  int y1, a, b;
  cin >> y1 >> a >> b;
  cin >> n;
  l.resize(n);
  r.resize(n);
  for (int i = 0; i < n; ++i) cin >> l[i] >> r[i];
  cin >> q;
  x.resize(q);
  y.resize(q);
  for (int i = 0; i < q; ++i) cin >> x[i] >> y[i];
  sum.resize(n);
  sum[0] = r[0] - l[0];
  for (int i = 1; i < n; ++i) sum[i] = sum[i - 1] + r[i] - l[i];
  for (int i = 0; i < q; ++i) {
    cout << fixed << setprecision(10)
         << (ans(b, y1, x[i], y[i]) - ans(a, y1, x[i], y[i])) * (y[i] - y1) /
                y[i]
         << '\n';
  }
  return 0;
}
