#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-12;
const int MaxN = 1e5 + 15;
const int INF = 1e9;
int x[MaxN], y[MaxN];
int vx[MaxN], vy[MaxN];
long double X, XX, Y, YY;
int n;
bool bad(long double x, long double y, long double vx, long double vy) {
  if (x == X || x == XX)
    if (vx == 0) return true;
  if (y == Y || y == YY)
    if (vy == 0) return true;
  return false;
}
pair<long double, long double> intersect(pair<long double, long double> a,
                                         pair<long double, long double> b) {
  return make_pair(max(a.first, b.first), min(a.second, b.second));
}
pair<long double, long double> make(long double l, long double r, long double s,
                                    long double v) {
  pair<long double, long double> res;
  if (s >= l && s <= r) {
    res.first = 0;
    if (v == 0)
      res.second = (INF * 1ll * INF);
    else {
      if (v > 0)
        res.second = (r - s) / v;
      else
        res.second = (s - l) / -v;
    }
  } else {
    if (s > r) {
      if (v >= 0) return make_pair(1, -1);
      res.first = (s - r) / -v;
      res.second = (s - l) / -v;
    } else {
      if (v <= 0) return make_pair(1, -1);
      res.first = (l - s) / v;
      res.second = (r - s) / v;
    }
  }
  res.first += eps;
  res.second -= eps;
  return res;
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  cin >> X >> Y >> XX >> YY;
  if (X > XX) swap(X, XX);
  if (Y > YY) swap(Y, YY);
  pair<long double, long double> ans = make_pair(0, INF * 1ll * INF);
  for (int i = 1; i <= n; ++i) {
    cin >> x[i] >> y[i] >> vx[i] >> vy[i];
    if (bad(x[i], y[i], vx[i], vy[i])) {
      cout << "-1\n";
      return 0;
    }
    pair<long double, long double> p1 = make(X, XX, x[i], vx[i]);
    pair<long double, long double> p2 = make(Y, YY, y[i], vy[i]);
    ans = intersect(ans, intersect(p1, p2));
  }
  if (ans.first < ans.second)
    cout << setprecision(9) << ans.first << '\n';
  else
    cout << "-1\n";
  return 0;
}
