#include <bits/stdc++.h>
using namespace std;
void imp() {
  cout << -1;
  exit(0);
}
double mn = 0, mx = 2e9;
void solve(int x, int vx, int x1, int x2) {
  if (vx == 0) {
    if (x1 < x && x < x2) return;
    imp();
  }
  if (vx < 0) {
    mn = std::max(mn, (x2 - x) / (double)vx);
    mx = std::min(mx, (x1 - x) / (double)vx);
  } else {
    mn = std::max(mn, (x1 - x) / (double)vx);
    mx = std::min(mx, (x2 - x) / (double)vx);
  }
  if (mn >= mx) imp();
}
int main() {
  int n, x1, x2, y1, y2;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  for (int i = 0; i < n; ++i) {
    int x, y, vx, vy;
    cin >> x >> y >> vx >> vy;
    solve(x, vx, x1, x2);
    solve(y, vy, y1, y2);
  }
  cout << setprecision(17) << mn;
  return 0;
}
