#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const double EPS = 1e-9;
const int INF = 1 << 29;
int const NN = 1e5 + 5;
int rx[NN], ry[NN], vx[NN], vy[NN];
pair<double, double> ix[NN], iy[NN];
pair<double, double> getI(int x, int vx, int x1, int x2) {
  if (x1 > x2) swap(x1, x2);
  if (x == x1) {
    if (vx <= 0) {
      return make_pair(-1, -1);
    } else {
      return make_pair(1e-15, 1.0 * (x2 - x) / vx - (1e-15));
    }
  } else if (x == x2) {
    if (vx >= 0) {
      return make_pair(-1, -1);
    } else {
      return make_pair(1e-15, 1.0 * (x1 - x) / vx - (1e-15));
    }
  } else if (x > x1 && x < x2) {
    if (vx == 0) {
      return make_pair(0.0, 1e18);
    } else if (vx < 0) {
      return make_pair(0.0, 1.0 * (x1 - x) / vx - (1e-15));
    } else {
      return make_pair(0.0, 1.0 * (x2 - x) / vx - (1e-15));
    }
  } else if (x < x1) {
    if (vx <= 0) {
      return make_pair(-1, -1);
    } else {
      return make_pair(1.0 * (x1 - x) / vx + (1e-15),
                       1.0 * (x2 - x) / vx - (1e-15));
    }
  } else {
    if (vx >= 0) {
      return make_pair(-1, -1);
    } else {
      return make_pair(1.0 * (x2 - x) / vx + (1e-15),
                       1.0 * (x1 - x) / vx - (1e-15));
    }
  }
}
int main() {
  int n;
  cin >> n;
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  for (int i = 1; i <= n; ++i) cin >> rx[i] >> ry[i] >> vx[i] >> vy[i];
  if (x1 == x2 || y1 == y2) {
    puts("-1");
    return 0;
  }
  for (int i = 1; i <= n; ++i) {
    ix[i] = getI(rx[i], vx[i], x1, x2);
    if (ix[i].first == -1 || ix[i].second == -1) {
      puts("-1");
      return 0;
    }
    iy[i] = getI(ry[i], vy[i], y1, y2);
    if (iy[i].first == -1 || iy[i].second == -1) {
      puts("-1");
      return 0;
    }
  }
  double mn = max(ix[1].first, iy[1].first),
         mx = min(ix[1].second, iy[1].second);
  if (mn > mx) {
    puts("-1");
    return 0;
  }
  for (int i = 2; i <= n; ++i) {
    double mnn = max(ix[i].first, iy[i].first);
    double mxx = min(ix[i].second, iy[i].second);
    if (mnn > mxx) {
      puts("-1");
      return 0;
    }
    mn = max(mn, mnn);
    mx = min(mx, mxx);
    if (mn > mx) {
      puts("-1");
      return 0;
    }
  }
  printf("%.20lf\n", mn);
  return 0;
}
