#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
#pragma warning(disable : 4996)
using namespace std;
const int inf = 1e9;
const long long llinf = 1e18;
const long double pi =
    3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825;
int main() {
  srand(time(NULL));
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(7);
  int sy, a, b;
  cin >> sy >> a >> b;
  int n;
  cin >> n;
  vector<long double> l(n), r(n);
  for (int i = 0; i < n; ++i) {
    int tmp1, tmp2;
    cin >> tmp1 >> tmp2;
    l[i] = tmp1 + 0.;
    r[i] = tmp2 + 0.;
  }
  vector<int> pref(n + 1, 0);
  for (int i = 1; i <= n; ++i) pref[i] = pref[i - 1] + r[i - 1] - l[i - 1];
  int q;
  cin >> q;
  while (q--) {
    int x, y;
    cin >> x >> y;
    long double l1, r1;
    l1 = a * 1. + (x - a) * 1. * (0. - sy) / (long double)(y - sy);
    r1 = b * 1. + (x - b) * 1. * (0. - sy) / (long double)(y - sy);
    int lp = lower_bound(l.begin(), l.end(), l1) - l.begin();
    int rp = upper_bound(r.begin(), r.end(), r1) - r.begin();
    long double ans = 0.;
    if (lp > 0 && r[lp - 1] > l1) ans += r[lp - 1] - l1;
    if (rp < n && r1 > l[rp]) ans += r1 - l[rp];
    if (rp - 1 >= lp) ans += (long double)(pref[rp] - pref[lp]);
    ans = min(ans, r1 - l1);
    cout << fixed << (long double)(b - a) * ans / (r1 - l1) << '\n';
  }
  return 0;
}
