#include <bits/stdc++.h>
using namespace std;
pair<double, double> p[200200];
double dp[200200];
double sy, a, b;
int n, q;
double first, second;
double arr[200200];
double calc(double s) {
  int id = lower_bound(arr + 1, arr + n + 1, s) - arr - 1;
  if (id == 0) return 0;
  double ans = dp[id - 1];
  if (p[id].second > s)
    ans += s - p[id].first;
  else
    ans += p[id].second - p[id].first;
  return ans;
}
int main() {
  scanf("%lf %lf %lf %d", &sy, &a, &b, &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lf %lf", &p[i].first, &p[i].second);
    dp[i] = dp[i - 1] + p[i].second - p[i].first;
    arr[i] = p[i].first;
  }
  scanf("%d", &q);
  while (q--) {
    scanf("%lf %lf", &first, &second);
    double tmp = second / (second - sy);
    double pos = first + (b - first) * tmp;
    double ans = calc(pos);
    pos = first + (a - first) * tmp;
    ans -= calc(pos);
    printf("%.10lf\n", ans / tmp);
  }
}
