#include <bits/stdc++.h>
using namespace std;
struct Ratio {
  long long p;
  long long q;
  Ratio(long long p_, long long q_) : p(p_), q(q_) {}
  bool operator<(const Ratio& o) const { return p * o.q < q * o.p; }
  bool operator>(const Ratio& o) const { return p * o.q > q * o.p; }
  bool operator==(const Ratio& o) const { return p * o.q == q * o.p; }
};
int main() {
  ios_base::sync_with_stdio(false);
  long long x1, x2, y1, y2, n;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  vector<pair<long long, long long>> r(n), v(n);
  for (int i = 0; i < n; ++i) {
    cin >> r[i].first >> r[i].second >> v[i].first >> v[i].second;
  }
  bool has_upper = false;
  Ratio ans_upper{0, 1}, ans_lower{0, 1};
  for (int i = 0; i < n; ++i) {
    if (v[i].first == 0) {
      if (r[i].first < x1 || r[i].first > x2) {
        cout << -1 << "\n";
        return 0;
      }
    } else if (v[i].first > 0) {
      if (x1 > r[i].first) {
        ans_lower = max(ans_lower, Ratio(x1 - r[i].first, v[i].first));
      }
      if (x2 < r[i].first) {
        cout << -1 << '\n';
        return 0;
      }
      if (has_upper)
        ans_upper = min(ans_upper, Ratio(x2 - r[i].first, v[i].first));
      else
        ans_upper = Ratio(x2 - r[i].first, v[i].first);
      has_upper = true;
    } else {
      if (r[i].first < x1) {
        cout << -1 << '\n';
        return 0;
      }
      if (has_upper)
        ans_upper = min(ans_upper, Ratio(r[i].first - x1, -v[i].first));
      else
        ans_upper = Ratio(r[i].first - x1, -v[i].first);
      has_upper = true;
      if (r[i].first > x2) {
        ans_lower = max(ans_lower, Ratio(r[i].first - x2, -v[i].first));
      }
    }
    if (v[i].second == 0) {
      if (r[i].second < y1 || r[i].second > y2) {
        cout << -1 << "\n";
        return 0;
      }
    } else if (v[i].second > 0) {
      if (y1 > r[i].second) {
        ans_lower = max(ans_lower, Ratio(y1 - r[i].second, v[i].second));
      }
      if (y2 < r[i].second) {
        cout << -1 << '\n';
        return 0;
      }
      if (has_upper)
        ans_upper = min(ans_upper, Ratio(y2 - r[i].second, v[i].second));
      else
        ans_upper = Ratio(y2 - r[i].second, v[i].second);
      has_upper = true;
    } else {
      if (r[i].second < y1) {
        cout << -1 << '\n';
        return 0;
      }
      if (has_upper)
        ans_upper = min(ans_upper, Ratio(r[i].second - y1, -v[i].second));
      else
        ans_upper = Ratio(r[i].second - y1, -v[i].second);
      has_upper = true;
      if (r[i].second > y2) {
        ans_lower = max(ans_lower, Ratio(r[i].second - y2, -v[i].second));
      }
    }
    if (has_upper && !(ans_lower < ans_upper)) {
      cout << -1 << "\n";
      return 0;
    }
  }
  for (int i = 0; i < n; ++i) {
    if (v[i].first == 0 && (r[i].first == x1 || r[i].first == x2)) {
      cout << -1 << "\n";
      return 0;
    }
    if (v[i].second == 0 && (r[i].second == y1 || r[i].second == y2)) {
      cout << -1 << "\n";
      return 0;
    }
  }
  cout << fixed << setprecision(9) << (ans_lower.p + 0.0) / ans_lower.q << "\n";
  return 0;
}
