#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a, b, c, d;
  cin >> a >> b >> c >> d;
  long long r[n][2], v[n][2];
  for (int i = 0, ThxDem = n; i < ThxDem; ++i)
    cin >> r[i][0] >> r[i][1] >> v[i][0] >> v[i][1];
  long double t[n][2];
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) {
    if (v[i][0] != 0 && v[i][1] != 0) {
      t[i][0] =
          max(min(1. * (a - r[i][0]) / v[i][0], 1. * (c - r[i][0]) / v[i][0]),
              min(1. * (b - r[i][1]) / v[i][1], 1. * (d - r[i][1]) / v[i][1]));
      t[i][1] =
          min(max(1. * (a - r[i][0]) / v[i][0], 1. * (c - r[i][0]) / v[i][0]),
              max(1. * (b - r[i][1]) / v[i][1], 1. * (d - r[i][1]) / v[i][1]));
    }
    if (v[i][0] == 0 && v[i][1] != 0) {
      if (r[i][0] <= a || r[i][0] >= c) {
        cout << -1;
        return 0;
      }
      t[i][0] = min(1. * (b - r[i][1]) / v[i][1], 1. * (d - r[i][1]) / v[i][1]);
      t[i][1] = max(1. * (b - r[i][1]) / v[i][1], 1. * (d - r[i][1]) / v[i][1]);
    }
    if (v[i][0] != 0 && v[i][1] == 0) {
      if (r[i][1] <= b || r[i][1] >= d) {
        cout << -1;
        return 0;
      }
      t[i][0] = min(1. * (a - r[i][0]) / v[i][0], 1. * (c - r[i][0]) / v[i][0]);
      t[i][1] = max(1. * (a - r[i][0]) / v[i][0], 1. * (c - r[i][0]) / v[i][0]);
    }
    if (v[i][0] == 0 && v[i][1] == 0) {
      if (r[i][0] <= a || r[i][0] >= c || r[i][1] <= b || r[i][1] >= d) {
        cout << -1;
        return 0;
      }
      t[i][0] = 0;
      t[i][1] = 1e18;
    }
  }
  long double res = 0, tmax = 1e19;
  for (int i = 0, ThxDem = n; i < ThxDem; ++i) {
    if (t[i][0] + 1e-10 > t[i][1]) {
      cout << -1;
      return 0;
    }
    res = max(res, t[i][0]);
    tmax = min(tmax, t[i][1]);
  }
  if (res + 1e-10 > tmax) {
    cout << -1;
    return 0;
  }
  cout << fixed << setprecision(12) << res;
  return 0;
}
