#include <bits/stdc++.h>
using namespace std;
using namespace rel_ops;
using ll = int64_t;
using Pii = pair<int, int>;
using ull = uint64_t;
using Vi = vector<int>;
void run();
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  run();
  return 0;
}
using Point = pair<ll, ll>;
ll sY, a, b;
int n;
vector<Point> segments;
vector<ll> prefs;
Point cur;
double proj(Point point, ll first) {
  double alfa = double(point.first - first) / double(point.second);
  return alfa * double(sY) + double(first);
}
bool projCmp(Point l, ll val) {
  return (cur.first - l.second) * sY + l.second * cur.second < val * cur.second;
}
void handle() {
  cin >> cur.first >> cur.second;
  int begin =
      int(lower_bound((segments).begin(), (segments).end(), a, projCmp) -
          segments.begin());
  int end = int(lower_bound((segments).begin(), (segments).end(), b, projCmp) -
                segments.begin());
  double ret = double(prefs[end] - prefs[begin]) * double(cur.second - sY) /
               double(cur.second);
  if (begin < n) {
    ret -= max(double(a) - proj(cur, segments[begin].first), 0.0);
  }
  if (end < n) {
    ret += max(double(b) - proj(cur, segments[end].first), 0.0);
  }
  cout << ret << '\n';
}
void run() {
  cin >> sY >> a >> b >> n;
  segments.resize(n);
  prefs.push_back(0);
  for (auto& s : (segments)) {
    cin >> s.first >> s.second;
    prefs.push_back(prefs.back() + s.second - s.first);
  }
  int q;
  cin >> q;
  while (q--) handle();
}
