#include <bits/stdc++.h>
using namespace std;
double l = 0;
double r = 1e11;
void doit(int pos, int lb, int rb, int v) {
  if (v == 0) {
    if (pos > lb && pos < rb) {
      return;
    }
    r = -1;
  }
  double t1 = (double)(lb - pos) / v;
  double t2 = (double)(rb - pos) / v;
  if (t1 > t2) {
    swap(t1, t2);
  }
  l = max(l, t1);
  r = min(r, t2);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  int x1, y1, x2, y2;
  cin >> n;
  cin >> x1 >> y1 >> x2 >> y2;
  for (int i = 1; i <= n; i += 1) {
    int inix, iniy, vix, viy;
    cin >> inix >> iniy >> vix >> viy;
    doit(inix, x1, x2, vix);
    doit(iniy, y1, y2, viy);
  }
  if (r - l >= 1e-11 && r > 0) {
    printf("%.11lf\n", l);
  } else {
    printf("-1\n");
  }
  return 0;
}
