#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
int c, a, b, n, q;
vector<double> xs;
vi sm, L, R;
double f(double x) {
  int k = lower_bound((xs).begin(), (xs).end(), x) - xs.begin();
  double re = sm[k / 2];
  if (k % 2) {
    re += x - xs[k - 1];
  }
  return re;
}
void solve() {
  cin >> c >> a >> b >> n;
  xs.resize(2 * n);
  sm.resize(2 * n + 1);
  L.resize(n);
  R.resize(n);
  for (int(i) = (0); (i) < (int)(n); ++(i)) {
    int &l = L[i], &r = R[i];
    cin >> l >> r;
    xs[2 * i] = l;
    xs[2 * i + 1] = r;
    sm[i + 1] = sm[i] + (r - l);
  }
  cin >> q;
  for (int(i) = (0); (i) < (int)(q); ++(i)) {
    int x, y;
    cin >> x >> y;
    double p = x - (double)y * (x - a) / (y - c);
    double q = x - (double)y * (x - b) / (y - c);
    double re = (f(q) - f(p)) / (q - p) * (b - a);
    cout << re << endl;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}
