#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int mod = 1e9 + 7;
int sy, a, b, n, q, p1, p2, x, y;
int s[N], l[N], r[N];
double L, R, ans;
int main() {
  scanf("%d%d%d%d", &sy, &a, &b, &n);
  for (int i = (1); i < (n + 1); i++)
    scanf("%d%d", &l[i], &r[i]), s[i] = s[i - 1] + r[i] - l[i];
  scanf("%d", &q);
  for (int i = (1); i < (q + 1); i++) {
    scanf("%d%d", &x, &y);
    ans = 0;
    L = x - 1.0 * y / (y - sy) * (x - a);
    R = x - 1.0 * y / (y - sy) * (x - b);
    p1 = lower_bound(l + 1, l + n + 1, L) - l;
    p2 = upper_bound(r + 1, r + n + 1, R) - r;
    p2--;
    if (p1 <= p2) ans += s[p2] - s[p1 - 1];
    if (p1 - 1 == p2 + 1 && p1 - 1 >= 1 && p1 - 1 <= n)
      ans += R - L;
    else {
      if (p1 - 1 > 0 && L >= l[p1 - 1] && L <= r[p1 - 1]) ans += r[p1 - 1] - L;
      if (p2 + 1 <= n && R >= l[p2 + 1] && R <= r[p2 + 1]) ans += R - l[p2 + 1];
    }
    ans *= 1.0 * (y - sy) / y;
    printf("%.8f\n", ans);
  }
  return 0;
}
