#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  for (int i = 0; i < v.size(); i++) os << v[i] << " ";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& v) {
  for (typename set<T>::iterator it = v.begin(); it != v.end(); it++)
    os << *it << " ";
}
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
int gi() {
  int w = 0;
  bool q = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') q = 0, c = getchar();
  while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar();
  return q ? w : -w;
}
int l[N], r[N], s[N];
int sy, a, b;
int x, y;
int main() {
  sy = gi();
  a = gi();
  b = gi();
  int n;
  n = gi();
  for (int i = (1); i <= (n); i++) {
    l[i] = gi(), r[i] = gi();
    s[i] = s[i - 1] + r[i] - l[i];
  }
  int q;
  q = gi();
  while (q--) {
    x = gi(), y = gi();
    long double rat = (long double)sy / (sy - y);
    long double ax = (x - a) * rat + a;
    long double bx = (x - b) * rat + b;
    int pa = upper_bound(l + 1, l + n + 1, ax) - l;
    int push_back = upper_bound(l + 1, l + n + 1, bx) - l;
    long double suma = s[pa - 1] - (ax < r[pa - 1] ? r[pa - 1] - ax : 0);
    long double sumb =
        s[push_back - 1] - (bx < r[push_back - 1] ? r[push_back - 1] - bx : 0);
    printf("%.9lf\n", (double)(sumb - suma) / (double)(1 - rat));
  }
  return 0;
}
