#include <bits/stdc++.h>
using namespace std;
const int N = int(3e5), mod = int(1e9) + 7;
int n, x1, x2, sda, y2;
double L = 0, R = 1e12;
void pr() {
  puts("-1");
  exit(0);
}
int main() {
  scanf("%d%d%d%d%d", &n, &x1, &sda, &x2, &y2);
  bool ok = 1;
  for (int i = 1; i <= n; i++) {
    int rx, ry, vx, vy;
    scanf("%d%d%d%d", &rx, &ry, &vx, &vy);
    double tr = 1e12, tl = 0;
    int cnt = 0;
    if (x1 <= rx && rx <= x2 && sda <= ry && ry <= y2) {
      if (rx != x1 || rx != x2 || ry != sda || ry != y2) cnt = 1;
    }
    if (!cnt) ok = 0;
    if (rx <= x1) {
      if (vx <= 0) pr();
      tl = (x1 - rx + 0.0) / vx;
      tr = (x2 - rx + 0.0) / vx;
    } else if (rx >= x2) {
      if (vx >= 0) pr();
      tl = (rx - x2 + 0.0) / abs(vx);
      tr = (rx - x1 + 0.0) / abs(vx);
    } else {
      if (vx > 0) {
        tl = 0;
        tr = (x2 - rx + 0.0) / vx;
      } else if (vx < 0) {
        tl = 0;
        tr = (rx - x1 + 0.0) / abs(vx);
      }
    }
    if (ry <= sda) {
      if (vy <= 0) pr();
      tl = max(tl, (sda - ry + 0.0) / vy);
      tr = min(tr, (y2 - ry + 0.0) / vy);
    } else if (ry >= y2) {
      if (vy >= 0) pr();
      tl = max(tl, (ry - y2 + 0.0) / abs(vy));
      tr = min(tr, (ry - sda + 0.0) / abs(vy));
    } else {
      if (vy > 0) {
        tl = max(0.0, tl);
        tr = min(tr, (y2 - ry + 0.0) / vy);
      } else if (vy < 0) {
        tl = max(0.0, tl);
        tr = min(tr, (ry - sda + 0.0) / abs(vy));
      }
    }
    L = max(L, tl);
    R = min(R, tr);
  }
  if (ok) {
    cout << 0;
    return 0;
  }
  if (L >= R) pr();
  printf("%.12lf", L);
  return 0;
}
