#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
double mint = 0, maxt = 999999999;
void func(double s, double e, double r, double v) {
  double ts, te;
  if (v == 0 && r > s && r < e)
    return;
  else if (v == 0) {
    cout << "-1";
    exit(0);
  }
  if (v > 0) {
    ts = (s - r) / v;
    te = (e - r) / v;
    mint = max(mint, min(ts, te));
    maxt = min(maxt, max(ts, te));
  } else {
    te = (s - r) / v;
    ts = (e - r) / v;
    mint = max(mint, min(ts, te));
    maxt = min(maxt, max(ts, te));
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int i, j, k, m, n;
  cin >> n;
  double x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  for (int T = 1; T <= n; ++T) {
    double rx, ry, vx, vy;
    cin >> rx >> ry >> vx >> vy;
    func(x1, x2, rx, vx);
    func(y1, y2, ry, vy);
  }
  if (maxt - mint > 0.000000000001)
    cout << setprecision(16) << mint;
  else
    cout << "-1";
  return 0;
}
