#include <bits/stdc++.h>
using namespace std;
int sy, a, b, n, l[200010], r[200010], sum[200010], m, x, y;
double xl, xr, ans;
int getmid(double xi) {
  int L = 1, R = n + 1, ret, mid;
  while (L < R) {
    mid = (L + R) >> 1;
    if (l[mid] <= xi)
      ret = mid, L = mid + 1;
    else
      R = mid;
  }
  return ret;
}
double getlenth(double xi) {
  if (xi <= l[1]) return 0;
  int pos = getmid(xi);
  return min(xi, (double)r[pos]) - l[pos] + sum[pos - 1];
}
int main() {
  scanf("%d%d%d", &sy, &a, &b);
  scanf("%d", &n);
  sum[0] = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%d%d", &l[i], &r[i]);
    sum[i] = sum[i - 1] + r[i] - l[i];
  }
  scanf("%d", &m);
  while (m--) {
    scanf("%d%d", &x, &y);
    xl = -1.0 * (x - a) / (y - sy) * y + x;
    xr = -1.0 * (x - b) / (y - sy) * y + x;
    ans = (getlenth(xr) - getlenth(xl)) / (xr - xl) * (b - a);
    printf("%.10lf\n", ans);
  }
  return 0;
}
