#include <bits/stdc++.h>
using namespace std;
double ff(double x, double x1, double x2, double vel) {
  if (vel == 0.000000) {
    if (x >= x1 && x <= x2)
      return 0.0000;
    else
      return 1e18;
  }
  if (x >= x1 && x <= x2) return 0.000000;
  return min((x1 - x) / vel, (x2 - x) / vel);
}
double la(double x, double x1, double x2, double vel) {
  if (vel == 0.000000) {
    if (x >= x1 && x <= x2)
      return (1e18);
    else
      return 0.000;
  }
  if (vel > 0) return (x2 - x) / vel;
  return (x1 - x) / vel;
}
int main() {
  int n, i;
  double x1, y1, x2, y2;
  scanf("%d", &n);
  cin >> x1 >> y1 >> x2 >> y2;
  if (x1 > x2) swap(x1, x2);
  if (y1 > y2) swap(y1, y2);
  x1 += 1e-9;
  x2 -= 1e-9;
  y1 += 1e-9;
  y2 -= 1e-9;
  double ss = 0, ee = 1e18;
  for (i = 1; i <= n; i++) {
    double rx, ry, vx, vy;
    scanf("%lf%lf%lf%lf", &rx, &ry, &vx, &vy);
    double st = max(ff(rx, x1, x2, vx), ff(ry, y1, y2, vy)),
           en = min(la(rx, x1, x2, vx), la(ry, y1, y2, vy));
    ss = max(ss, st);
    ee = min(ee, en);
  }
  if (ee - ss < 1e-18)
    printf("-1");
  else
    printf("%.9lf", ss);
  return 0;
}
