#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
struct pos {
  int x, y;
  int vx, vy;
} V[N];
const long double mn = 1e-18;
const long double mx = 1e18;
pair<long double, long double> calc(int x, int x1, int x2, int vx) {
  if (vx == 0) {
    if (x > x1 && x < x2) {
      return {mn, mx};
    }
    return {-1., -2.};
  }
  if (x >= x2 && vx > 0) {
    return {-1., -2.};
  }
  if (x <= x1 && vx < 0) {
    return {-1., -2.};
  }
  if (x >= x1 && x <= x2) {
    int dist = 0;
    if (vx >= 0) {
      dist = x2 - x;
    } else {
      dist = x - x1;
      vx = -vx;
    }
    return {mn, dist / 1. / vx};
  }
  int dist;
  if (x < x1) {
    dist = x1 - x;
  } else {
    dist = x - x2;
  }
  if (vx < 0) {
    vx = -vx;
  }
  return {dist / 1. / vx, (dist + x2 - x1) / 1. / vx};
}
int main() {
  int n;
  scanf("%d", &n);
  int x1, y1, x2, y2;
  scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
  if (x1 == x2 || y1 == y2) {
    printf("-1\n");
    return 0;
  }
  long double ans1 = mn;
  long double ans2 = mx;
  for (int i = 1; i <= n; ++i) {
    scanf("%d %d %d %d", &V[i].x, &V[i].y, &V[i].vx, &V[i].vy);
    pair<long double, long double> a = calc(V[i].x, x1, x2, V[i].vx);
    pair<long double, long double> b = calc(V[i].y, y1, y2, V[i].vy);
    ans1 = max(ans1, a.first);
    ans1 = max(ans1, b.first);
    ans2 = min(ans2, a.second);
    ans2 = min(ans2, b.second);
  }
  if (ans1 >= ans2) {
    printf("-1\n");
  } else {
    double ans = ans1 + mn;
    printf("%.10lf\n", ans);
  }
}
