#include <bits/stdc++.h>
using namespace std;
double L = 0, R = 1e9;
void solve(int r, int v, int x, int y) {
  if (v == 0 && (r <= x || r >= y)) {
    cout << -1;
    exit(0);
  }
  double X = 1.0 * (x - r) / v;
  double Y = 1.0 * (y - r) / v;
  L = max(L, min(X, Y));
  R = min(R, max(X, Y));
}
int main() {
  int n;
  int x1, y1, x2, y2;
  cin >> n;
  cin >> x1 >> y1 >> x2 >> y2;
  for (int i = 1; i <= n; i++) {
    int rx, ry, vx, vy;
    cin >> rx >> ry >> vx >> vy;
    solve(rx, vx, x1, x2);
    solve(ry, vy, y1, y2);
  }
  cout << (L >= R ? -1 : L);
  return 0;
}
