#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int maxn = 1e3 + 5;
const int maxx = 1e5 + 100;
const double EPS = 1e-11;
const int MOD = 1000000007;
template <class T>
inline T min(T a, T b, T c) {
  return min(min(a, b), c);
}
template <class T>
inline T max(T a, T b, T c) {
  return max(max(a, b), c);
}
template <class T>
inline T min(T a, T b, T c, T d) {
  return min(min(a, b), min(c, d));
}
template <class T>
inline T max(T a, T b, T c, T d) {
  return max(max(a, b), max(c, d));
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  a %= b;
  return gcd(b, a);
}
double l = 0, r = INF;
void solve(int v, int v1, int v2, int val) {
  if (val == 0) {
    if (v > v1 && v < v2) return;
    r = -1;
  }
  double t1 = (double)(v1 - v) / val, t2 = (double)(v2 - v) / val;
  if (t1 > t2) swap(t1, t2);
  l = max(l, t1);
  r = min(r, t2);
}
int main() {
  int n, x1, y1, x2, y2;
  cin >> n;
  cin >> x1 >> y1 >> x2 >> y2;
  for (int i = 1; i <= n; i++) {
    int x, y, vx, vy;
    cin >> x >> y >> vx >> vy;
    solve(x, x1, x2, vx);
    solve(y, y1, y2, vy);
  }
  if (r - l >= EPS && r > 0)
    printf("%.12lf\n", l);
  else
    cout << -1 << '\n';
}
