#include <bits/stdc++.h>
using namespace std;
const int N = 400005;
double ti[N], v[N];
int A, B, n, sy, y[N], q, tot, x[N], a[N], b[N], f[N];
struct Ask {
  double x;
  int flag, from;
} ask[N * 2];
int cmp(Ask x, Ask y) { return x.x < y.x; }
int main() {
  scanf("%d%d%d%d", &sy, &A, &B, &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &a[i], &b[i]), f[i] = f[i - 1] + b[i] - a[i];
  scanf("%d", &q);
  for (int i = 1; i <= q; i++) {
    scanf("%d%d", &x[i], &y[i]);
    ask[++tot].flag = -1,
    ask[tot].x = A + (double)(x[i] - A) / (y[i] - sy) * (-sy);
    ask[tot].from = i;
    ask[++tot].flag = 1,
    ask[tot].x = B + (double)(x[i] - B) / (y[i] - sy) * (-sy);
    ask[tot].from = i;
    ti[i] = ask[tot].x - ask[tot - 1].x;
  }
  sort(ask + 1, ask + tot + 1, cmp);
  int now = 1;
  for (int i = 1; i <= tot; i++) {
    while (now <= n && ask[i].x >= b[now]) now++;
    double k = f[now - 1];
    if (ask[i].x >= a[now] && ask[i].x <= b[now]) k += ask[i].x - a[now];
    v[ask[i].from] += ask[i].flag * k;
  }
  for (int i = 1; i <= q; i++)
    printf("%.10lf\n", (double)v[i] / ti[i] * (B - A));
}
