#include <bits/stdc++.h>
using namespace std;
int n, q, lo, hi, mid, A, B, l[1 << 20], p[1 << 20], sum[1 << 20], rx, ry, rs,
    ra, rb;
double k, lewy, prawy, s, a, b, res, x, y;
int lbound(int x) {
  lo = 1;
  hi = n + 1;
  mid = (lo + hi) / 2;
  while (lo != hi) {
    if (l[mid] > x)
      hi = mid;
    else
      lo = mid + 1;
    mid = (lo + hi) / 2;
  }
  return mid - 1;
}
double przec(double pocz, double kon) {
  if (pocz > prawy || kon < lewy) return 0;
  pocz = max(pocz, lewy);
  kon = min(kon, prawy);
  return kon - pocz;
}
int main() {
  scanf("%d%d%d", &rs, &ra, &rb);
  s = rs;
  a = ra;
  b = rb;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &l[i], &p[i]);
    sum[i] = sum[i - 1] + (p[i] - l[i]);
  }
  scanf("%d", &q);
  l[n + 1] = INT_MAX;
  while (q--) {
    scanf("%d%d", &rx, &ry);
    x = rx;
    y = ry;
    res = 0;
    k = (y + abs(s)) / y;
    lewy = x + (a - x) / k;
    prawy = x + (b - x) / k;
    A = lbound(lewy);
    B = lbound(prawy);
    if (A > 0) res += przec(l[A], p[A]) * k;
    if (A != B && B > 0) res += przec(l[B], p[B]) * k;
    A++;
    B--;
    if (A <= B) res += (double)(sum[B] - sum[A - 1]) * k;
    printf("%f\n", res);
  }
}
