#include <bits/stdc++.h>
using namespace std;
const double eps = 5e-11, inf = 1e70;
bool cal(double r, double v, double x1, double x2, double& t1, double& t2) {
  x1 -= r;
  x2 -= r;
  if (fabs(v) < eps) {
    if (x2 > eps && x1 < -eps) {
      t1 = 0;
      t2 = inf;
      return true;
    } else {
      return false;
    }
  } else if (v > 0) {
    t1 = max(0., x1 / v);
    t2 = x2 / v;
  } else {
    t1 = max(0., x2 / v);
    t2 = x1 / v;
  }
  return t2 - t1 > eps;
}
inline bool intersection(double a, double b, double c, double d, double& e,
                         double& f) {
  e = max(a, c);
  f = min(b, d);
  return f - e > eps;
}
const int N = 1e5;
double s[N], t[N];
int main() {
  int n, x1, x2, y1, y2;
  scanf("%d%d%d%d%d", &n, &x1, &y1, &x2, &y2);
  for (int i = (0), i_end = (n); i < i_end; ++i) {
    double t1, t2, t3, t4;
    int rx, ry, vx, vy;
    scanf("%d%d%d%d", &rx, &ry, &vx, &vy);
    if (!(cal(rx, vx, x1, x2, t1, t2) && cal(ry, vy, y1, y2, t3, t4) &&
          intersection(t1, t2, t3, t4, s[i], t[i]))) {
      puts("-1");
      return 0;
    }
  }
  for (int i = (1), i_end = (n); i < i_end; ++i)
    if (!intersection(s[0], t[0], s[i], t[i], s[0], t[0])) {
      puts("-1");
      return 0;
    }
  printf("%.8f\n", s[0]);
  return 0;
}
