#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
long long L[N], R[N];
long long sum[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long s, a, b;
  cin >> s >> a >> b;
  s *= -1;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> L[i] >> R[i];
    sum[i] = R[i] - L[i] + sum[i - 1];
  }
  int q;
  cin >> q;
  while (q--) {
    long long x, y;
    cin >> x >> y;
    double ans = 0;
    double cnt = (double)s / y + 1;
    int la = 0, ra = n;
    while (la < ra) {
      int m = (la + ra + 1) >> 1;
      if (s * (L[m] - x) + L[m] * y < a * y) {
        la = m;
      } else
        ra = m - 1;
    }
    if (la > 0) ans += max(0.0, (double)(s * (R[la] - x)) / y + R[la] - a);
    ans -= sum[la] * cnt;
    int last = la;
    la = 1, ra = n + 1;
    while (la < ra) {
      int m = (la + ra) >> 1;
      if (s * (R[m] - x) + R[m] * y > b * y) {
        ra = m;
      } else
        la = m + 1;
    }
    if (la <= n) ans += max(0.0, b - (double)(s * (L[la] - x)) / y - L[la]);
    ans += sum[la - 1] * cnt;
    if (last == la) ans = b - a;
    cout << setprecision(15) << fixed << ans << "\n";
  }
  return 0;
}
