#include <bits/stdc++.h>
using namespace std;
void solve(double a, double b, double p, double v, double &r1, double &r2) {
  if (v == 0.0) {
    if (p > a && p < b) return;
    printf("-1\n");
    exit(0);
  }
  double ini, fin;
  ini = (a - p) / v + 0.0;
  fin = (b - p) / v + 0.0;
  if (ini > fin) swap(ini, fin);
  if (ini < 0.0 && fin < 0.0) {
    printf("-1\n");
    exit(0);
  }
  if (ini >= 0.0) r1 = max(r1, ini);
  if (fin >= 0.0) r2 = min(r2, fin);
  return;
}
int main() {
  double p1x, p1y, p2x, p2y;
  double res1, res2;
  int n;
  scanf("%d", &n);
  scanf("%lf %lf %lf %lf", &p1x, &p1y, &p2x, &p2y);
  if (p1x > p2x) swap(p1x, p2x);
  if (p1y > p2y) swap(p1y, p2y);
  res1 = 0.0;
  res2 = 9999999999.0;
  while (n--) {
    double x, y, vx, vy;
    scanf("%lf %lf %lf %lf", &x, &y, &vx, &vy);
    solve(p1x, p2x, x, vx, res1, res2);
    solve(p1y, p2y, y, vy, res1, res2);
  }
  if (res1 >= res2) {
    printf("-1\n");
    return 0;
  }
  printf("%.9lf\n", res1);
  return 0;
}
