#include <bits/stdc++.h>
using namespace std;
pair<double, double> timeRange(double s, double v, double l, double h) {
  if (v == 0) {
    if (s > l && s < h) {
      return make_pair(0, 1e9);
    } else {
      return make_pair(1e9, -1);
    }
  } else if (v < 0) {
    return timeRange(-s, -v, -h, -l);
  } else {
    double timeToL = (l - s) / v;
    timeToL += 1e-13;
    double timeToR = (h - s) / v;
    timeToR -= 1e-13;
    if (s <= l)
      return make_pair(timeToL, timeToR);
    else if (s >= h) {
      return make_pair(1e9 + 1, -1);
    } else {
      return make_pair(0, timeToR);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, x1, y1, x2, y2;
  cin >> n >> x1 >> y1 >> x2 >> y2;
  double minT = -1e9;
  double maxT = 1e9;
  for (int i = int(0); i < int(n); i++) {
    int rx, ry, vx, vy;
    cin >> rx >> ry >> vx >> vy;
    pair<double, double> xt = timeRange(rx, vx, x1, x2);
    minT = max(minT, xt.first);
    maxT = min(maxT, xt.second);
    pair<double, double> yt = timeRange(ry, vy, y1, y2);
    minT = max(minT, yt.first);
    maxT = min(maxT, yt.second);
  }
  if (minT <= maxT && minT >= 0) {
    cout << setprecision(12);
    cout << minT << endl;
  } else {
    cout << -1;
  }
  return 0;
}
