#include <bits/stdc++.h>
using namespace std;
const int limit = 1000000;
double Y, a, b;
int n;
double l[limit], r[limit], len[limit], sumlen[limit];
double x, y;
double getpos(double despx) { return x + (despx - x) / y * (y + Y); }
void write(double sol) { printf("%.12f\n", sol); }
int main() {
  int inY, ina, inb;
  scanf("%d%d%d", &inY, &ina, &inb);
  Y = inY;
  a = ina;
  b = inb;
  Y *= -1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int inl, inr;
    scanf("%d%d", &inl, &inr);
    l[i] = inl;
    r[i] = inr;
    len[i] = r[i] - l[i];
    sumlen[i] = sumlen[i - 1] + len[i];
  }
  int cases;
  scanf("%d", &cases);
  for (int cas = 0; cas < cases; cas++) {
    int inx, iny;
    scanf("%d%d", &inx, &iny);
    x = inx;
    y = iny;
    int leftmost;
    double sol = 0;
    {
      int inf = 0;
      int sup = n + 1;
      while (inf + 1 < sup) {
        int med = (inf + sup) / 2;
        if (a < getpos(r[med]))
          sup = med;
        else
          inf = med;
      }
      leftmost = sup;
      if (leftmost == n + 1 or b < getpos(l[leftmost])) {
        write(0.0);
        continue;
      }
      if (getpos(l[leftmost]) < a) {
        if (b < getpos(r[leftmost])) {
          write(b - a);
          continue;
        } else {
          sol += getpos(r[leftmost]) - a;
          leftmost++;
        }
      } else {
        if (b < getpos(r[leftmost])) {
          write(b - getpos(l[leftmost]));
          continue;
        }
      }
    }
    int rightmost;
    {
      int inf = 0;
      int sup = n + 1;
      while (inf + 1 < sup) {
        int med = (inf + sup) / 2;
        if (getpos(l[med]) < b)
          inf = med;
        else
          sup = med;
      }
      rightmost = inf;
    }
    if (rightmost == 0 or getpos(r[rightmost]) < a) {
      write(0.0);
      continue;
    }
    if (b < getpos(r[rightmost])) {
      if (getpos(l[rightmost]) < a) {
        write(b - a);
        continue;
      } else {
        sol += b - getpos(l[rightmost]);
        rightmost--;
      }
    } else {
      if (getpos(l[rightmost]) < a) {
        write(getpos(r[rightmost]) - a);
        continue;
      }
    }
    if (leftmost <= rightmost)
      sol += getpos(sumlen[rightmost] - sumlen[leftmost - 1]) - getpos(0);
    write(sol);
  }
}
