#include <bits/stdc++.h>
using namespace std;
const int oo = 1000000007;
struct line {
  long double a, b, c;
  void make(const pair<long double, long double> &p1,
            const pair<long double, long double> &p2) {
    a = p2.second - p1.second;
    b = p1.first - p2.first;
    c = -a * p1.first - b * p1.second;
  }
};
long double n, x1, y_1, x2, y2, u1[100010], v1[100010], u2[100010], v2[100010],
    vx[100010], vy[100010], resl = 0, resr = oo;
pair<long double, long double> P1[5], P2[5], PP1[100010], PP2[100010];
vector<pair<long double, long double> > d[100010];
line L[5], l[100010];
pair<long double, long double> cut(const line &l1, const line &l2) {
  pair<long double, long double> p;
  long double tmpa = l2.c * l1.a - l1.c * l2.a,
              tmpb = l2.c * l1.b - l1.c * l2.b, tmp = l1.b * l2.a - l2.b * l1.a;
  if (abs(tmp) < 1e-10) {
    if (abs(tmpa) < 1e-10 && abs(tmpb) < 1e-10)
      return (make_pair(-2 * oo, -2 * oo));
    return (make_pair(-oo, -oo));
  }
  p.second = tmpa / tmp;
  if (abs(l1.a) >= 1e-10)
    p.first = (-l1.c - l1.b * p.second) / l1.a;
  else
    p.first = (-l2.c - l2.b * p.second) / l2.a;
  return p;
}
bool mid(pair<long double, long double> p1, pair<long double, long double> p2,
         pair<long double, long double> p3) {
  if (p2.first - p1.first >= 1e-10 && p2.first - p3.first >= 1e-10)
    return false;
  if (p2.second - p1.second >= 1e-10 && p2.second - p3.second >= 1e-10)
    return false;
  if (p1.first - p2.first >= 1e-10 && p3.first - p2.first >= 1e-10)
    return false;
  if (p1.second - p2.second >= 1e-10 && p3.second - p2.second >= 1e-10)
    return false;
  return true;
}
void nosol() {
  cout << "-1";
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> x1 >> y_1 >> x2 >> y2;
  P1[1] = make_pair(x1, y_1);
  P2[1] = make_pair(x1, y2);
  P1[2] = make_pair(x1, y_1);
  P2[2] = make_pair(x2, y_1);
  P1[3] = make_pair(x2, y2);
  P2[3] = make_pair(x1, y2);
  P1[4] = make_pair(x2, y2);
  P2[4] = make_pair(x2, y_1);
  for (int i = 1, _key = 4; i <= _key; ++i) L[i].make(P1[i], P2[i]);
  for (int i = 1, _key = n; i <= _key; ++i) {
    cin >> u1[i] >> v1[i] >> vx[i] >> vy[i];
    PP1[i] = make_pair(u1[i], v1[i]);
    u2[i] = u1[i] + (long long)oo * vx[i];
    v2[i] = v1[i] + (long long)oo * vy[i];
    PP2[i] = make_pair(u2[i], v2[i]);
    l[i].a = -vy[i];
    l[i].b = vx[i];
    l[i].c = -l[i].a * u1[i] - l[i].b * v1[i];
    long double tl = oo, tr = 0;
    if (u1[i] - x1 >= 1e-10 && x2 - u1[i] >= 1e-10 && v1[i] - y_1 >= 1e-10 &&
        y2 - v1[i] >= 1e-10)
      tl = 0;
    if (vx[i] == 0 && vy[i] == 0) {
      if (u1[i] - x1 >= 1e-10 && x2 - u1[i] >= 1e-10 && v1[i] - y_1 >= 1e-10 &&
          y2 - v1[i] >= 1e-10)
        continue;
      else
        nosol();
    }
    for (int j = 1, _key = 4; j <= _key; ++j) {
      pair<long double, long double> pp = cut(l[i], L[j]);
      if (abs(pp.first + 2 * oo) <= 1e-10 && abs(pp.second + 2 * oo) <= 1e-10)
        nosol();
      else if (abs(pp.first + oo) <= 1e-10 && abs(pp.second + oo) <= 1e-10)
        continue;
      else if (mid(P1[j], pp, P2[j]) && mid(PP1[i], pp, PP2[i]))
        d[i].push_back(pp);
      else
        continue;
    }
    if (d[i].empty()) nosol();
    for (int j = 0, _key = d[i].size(); j < _key; ++j) {
      long double dd = -1;
      if (vx[i] != 0) dd = max(dd, abs(d[i][j].first - u1[i]) / abs(vx[i]));
      if (vy[i] != 0) dd = max(dd, abs(d[i][j].second - v1[i]) / abs(vy[i]));
      tl = min(tl, dd);
      tr = max(tr, dd);
    }
    if (tl == tr) nosol();
    resl = max(resl, tl);
    resr = min(resr, tr);
  }
  cout.precision(15);
  cout << fixed;
  if (resl < resr)
    cout << resl;
  else
    cout << "-1";
}
