#include <bits/stdc++.h>
using namespace std;
const long long M = 998244353;
const long long NMAX = 400011;
const long long inf = 1E9;
const long double eps = 1e-9;
const long long base = 29;
long long z[NMAX];
long long sum[NMAX];
signed main() {
  cin.tie(0);
  cout.tie(0);
  cin.sync_with_stdio(0);
  cout.sync_with_stdio(0);
  cout.precision(20);
  long long s, a, b;
  cin >> s >> a >> b;
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long l, r;
    cin >> l >> r;
    z[2 * i - 1] = l;
    z[2 * i] = r;
  }
  for (long long i = 1; i <= n; i++) {
    sum[2 * i - 1] = sum[2 * i - 2] - z[2 * i - 1];
    sum[2 * i] = sum[2 * i - 1] + z[2 * i];
  }
  long long q;
  cin >> q;
  for (long long i = 0; i < q; i++) {
    long long x, y;
    cin >> x >> y;
    long double l = x + (a - x) * y / (long double)(y - s);
    long double r = x + (b - x) * y / (long double)(y - s);
    long double suml = 0;
    auto u = upper_bound(z, z + 2 * n + 1, l) - z;
    u--;
    if ((u) % 2 == 0) {
      suml = sum[u];
    } else {
      suml = l + sum[u];
    }
    auto v = upper_bound(z, z + 2 * n + 1, r) - z;
    v--;
    long double sumr = 0;
    if ((v) % 2 == 0) {
      sumr = sum[v];
    } else {
      sumr = r + sum[v];
    }
    cout << (sumr - suml) * (y - s) / y << endl;
  }
  return 0;
};
