#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const double EPS = 1e-15, INF = 1e18;
double rx[N], ry[N], vx[N], vy[N];
int main() {
  double x1, y1, x2, y2, a = 0, b = INF;
  int n;
  scanf("%d%lf%lf%lf%lf", &n, &x1, &y1, &x2, &y2);
  for (int i = 0; i < n; ++i) {
    scanf("%lf%lf%lf%lf", &rx[i], &ry[i], &vx[i], &vy[i]);
    if (vx[i] == 0)
      if (x1 >= rx[i] || rx[i] >= x2) {
        printf("-1\n");
        return 0;
      }
    if (vy[i] == 0)
      if (y1 >= ry[i] || ry[i] >= y2) {
        printf("-1\n");
        return 0;
      }
    double ax, bx, ay, by;
    if (vx[i] == 0)
      ax = 0, bx = INF;
    else {
      ax = (x1 - rx[i]) / vx[i], bx = (x2 - rx[i]) / vx[i];
      if (vx[i] < 0) swap(ax, bx);
    }
    if (vy[i] == 0)
      ay = 0, by = INF;
    else {
      ay = (y1 - ry[i]) / vy[i], by = (y2 - ry[i]) / vy[i];
      if (vy[i] < 0) swap(ay, by);
    }
    a = max(a, max(ax, ay));
    b = min(b, min(bx, by));
  }
  if (b < a + EPS)
    printf("-1\n");
  else
    printf("%.8lf\n", a + EPS);
}
