#include <bits/stdc++.h>
using namespace std;
pair<double, double> a, b;
bool isInside(double x, double y) {
  return x > a.first && x < b.first && y > a.second && y < b.second;
}
pair<bool, double> findTime(double x, double y, double vx, double vy) {
  bool est = false;
  double l = 0, r = 200000;
  int it = 100;
  double ans;
  while (it--) {
    double mid = (l + r) / 2.0;
    bool ii = isInside(x + vx * mid, y + vy * mid);
    if (ii) {
      r = mid;
      ans = mid;
      est = true;
    } else {
      if (x + vx * mid > b.first && vx > 0)
        r = mid;
      else if (x + vx * mid < a.first && vx < 0)
        r = mid;
      else if (y + vy * mid > b.second && vy > 0)
        r = mid;
      else if (y + vy * mid < a.second && vy < 0)
        r = mid;
      else
        l = mid;
    }
  }
  return {est, ans};
}
double upperTime(double x, double y, double vx, double vy) {
  double l = 0, r = 200000;
  int it = 100;
  double ans;
  while (it--) {
    double mid = (l + r) / 2.0;
    bool ii = isInside(x + vx * mid, y + vy * mid);
    if (ii) {
      l = mid;
      ans = mid;
    } else {
      if (x + vx * mid > b.first && vx > 0)
        r = mid;
      else if (x + vx * mid < a.first && vx < 0)
        r = mid;
      else if (y + vy * mid > b.second && vy > 0)
        r = mid;
      else if (y + vy * mid < a.second && vy < 0)
        r = mid;
      else
        l = mid;
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  bool p = true;
  double minimax = 1e9;
  double maxmin = -1e9;
  pair<double, double> dat[100005];
  cin >> n;
  cin >> a.first >> a.second >> b.first >> b.second;
  int x, y, vx, vy;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> vx >> vy;
    pair<bool, double> tmp = findTime(x, y, vx, vy);
    if (!tmp.first) {
      p = false;
    } else {
      dat[i] = {tmp.second, upperTime(x, y, vx, vy)};
      minimax = min(minimax, dat[i].second);
      maxmin = max(maxmin, dat[i].first);
    }
  }
  if (p) {
    minimax -= 0.00000000001;
    maxmin += 0.00000000001;
    if (abs(minimax - maxmin) < 1e-14 || minimax > maxmin) {
      cout << setprecision(10) << fixed << maxmin << "\n";
    } else {
      cout << "-1\n";
    }
  } else {
    cout << "-1\n";
  }
}
