#include <bits/stdc++.h>
using namespace std;
int read();
int n, m, LS, RS, S;
struct POINT {
  int x, y;
} p[400021], ST, ED;
int s[400021];
int sum[400021];
long double loc(POINT a, POINT b) {
  return a.x - a.y * ((long double)a.x - b.x) / (a.y - b.y);
}
int find(long double v) {
  if (v < s[1]) return 0;
  int L = 1, R = 2 * n;
  while (L != R) {
    int mid = (L + R + 1) / 2;
    if (v - s[mid] > -1e-9) {
      L = mid;
    } else {
      R = mid - 1;
    }
  }
  return L;
}
long double len(long double L, long double R) {
  int l = find(L), r = find(R);
  long double ret = 0.000000;
  if (l & 1) {
    ret += s[l + 1] - L;
  }
  if (r & 1) {
    ret += R - s[r];
  }
  return ret + sum[r] - sum[l + 1];
}
int main() {
  scanf("%d", &S);
  LS = read();
  RS = read();
  ST.x = LS;
  ST.y = S;
  ED.x = RS;
  ED.y = S;
  n = read();
  for (int i = 1; i <= n; i++) {
    s[i * 2 - 1] = read();
    s[i * 2] = read();
    sum[i * 2 - 1] = sum[i * 2 - 2];
    sum[i * 2] = sum[i * 2 - 1] + s[i * 2] - s[i * 2 - 1];
  }
  sum[2 * n + 1] = sum[2 * n];
  m = read();
  for (int i = 1; i <= m; i++) {
    p[i].x = read();
    p[i].y = read();
    long double L = loc(ST, p[i]), R = loc(ED, p[i]);
    printf("%.15lf\n", (double)((RS - LS) / (R - L) * len(L, R)));
  }
  return 0;
}
int read() {
  int ret = 0;
  char ch = getchar();
  while (!(ch <= '9' && ch >= '0')) ch = getchar();
  while (ch <= '9' && ch >= '0') {
    ret *= 10;
    ret += ch - '0';
    ch = getchar();
  }
  return ret;
}
