#include <bits/stdc++.h>
using namespace std;
struct pt {
  double x, y;
};
bool check(double a, double b) {
  if (a < 0.00001) {
    a = 0.;
  }
  if (b < 0.00001) {
    return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  pt a, b, pos, vel;
  double minx, miny, maxx, maxy;
  cin >> a.x >> a.y >> b.x >> b.y;
  cout << fixed << setprecision(10);
  vector<pair<double, int> > times;
  for (int i = 0; i < n; i++) {
    cin >> pos.x >> pos.y >> vel.x >> vel.y;
    minx = (a.x - pos.x) / vel.x;
    miny = (a.y - pos.y) / vel.y;
    maxx = (b.x - pos.x) / vel.x;
    maxy = (b.y - pos.y) / vel.y;
    if (minx > maxx) swap(minx, maxx);
    if (miny > maxy) swap(miny, maxy);
    if (check(minx, maxx)) {
      times.push_back({minx, 1});
      times.push_back({maxx, -1});
    }
    if (check(miny, maxy)) {
      times.push_back({miny, 1});
      times.push_back({maxy, -1});
    }
  }
  sort(times.begin(), times.end());
  int depth = 0;
  for (int i = 0; i < times.size(); i++) {
    if (times[i].second == 1)
      depth++;
    else
      depth--;
    if (depth == 2 * n) {
      cout << max(times[i].first, 0.00000);
      return 0;
    }
  }
  cout << -1;
  return 0;
}
