#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream& operator<<(ostream& s, vector<T> t) {
  for (int i = 0; i < (int)(t.size()); i++) s << (i ? " " : "") << t[i];
  return s;
}
template <typename T>
istream& operator>>(istream& s, vector<T>& t) {
  for (int i = 0; i < (int)(t.size()); i++) s >> t[i];
  return s;
}
template <typename T, typename U>
ostream& operator<<(ostream& s, pair<T, U> t) {
  s << "(" << t.first << "," << t.second << ")";
  return s;
}
template <typename T, typename U>
istream& operator>>(istream& s, pair<T, U>& t) {
  s >> t.first >> t.second;
  return s;
}
typedef pair<double, double> it;
const double EPS = 1e-15;
it intersect(it a, it b) {
  if (a.first == -1 || b.first == -1) return {-1, -1};
  it res = {max(a.first, b.first), min(a.second, b.second)};
  if (res.first + EPS >= res.second) return {-1, -1};
  return res;
}
it get1D(double r, double v, double x1, double x2) {
  if (v == 0) {
    if (r > x1 && r < x2)
      return {0, 1e18};
    else
      return {-1, -1};
  }
  double t1 = (x1 - r) / v, t2 = (x2 - r) / v;
  if (t2 < t1) swap(t1, t2);
  if (t2 < 0) return {-1, -1};
  if (t1 < 0) t1 = 0;
  return {t1, t2};
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  it res = {0, 1e18};
  for (int i = 0; i < (int)(n); i++) {
    double rx, ry, vx, vy;
    cin >> rx >> ry >> vx >> vy;
    it xi = get1D(rx, vx, x1, x2);
    it yi = get1D(ry, vy, y1, y2);
    it cur = intersect(xi, yi);
    res = intersect(res, cur);
  }
  cout << fixed << setprecision(9);
  if (res.first == -1) {
    cout << "-1" << endl;
  } else {
    cout << res.first << endl;
  }
}
