#include <bits/stdc++.h>
using namespace std;
int n, px, py, lx, ly, rx, ry, vx, vy;
double lw = 0, pr = 1e9, x, y;
void spr(int r, int v, int z1, int z2) {
  if (v == 0 && (r <= z1 || r >= z2)) {
    cout << "-1";
    exit(0);
  }
  x = 1.0 * (z1 - r) / v;
  y = 1.0 * (z2 - r) / v;
  lw = max(lw, min(x, y));
  pr = min(pr, max(x, y));
}
int main() {
  cin >> n >> px >> py >> lx >> ly;
  for (int i = 0; i < n; i++) {
    cin >> rx >> ry >> vx >> vy;
    spr(rx, vx, px, lx);
    spr(ry, vy, py, ly);
  }
  if (lw >= pr)
    cout << "-1";
  else
    cout << lw;
}
