#include <bits/stdc++.h>
using namespace std;
const double INF = 1E200;
const double EP = 1E-13;
const int maxn = 200000;
const double PI = 3.14159265;
struct POINT {
  double x;
  double y;
  POINT(double a = 0, double b = 0) {
    x = a;
    y = b;
  }
};
struct LINESEG {
  POINT s;
  POINT e;
  LINESEG(POINT a, POINT b) {
    s = a;
    e = b;
  }
  LINESEG() {}
};
struct LINE {
  double a;
  double b;
  double c;
  LINE(double d1 = 1, double d2 = -1, double d3 = 0) {
    a = d1;
    b = d2;
    c = d3;
  }
};
struct node {
  double x;
  int flag;
  node() {}
  node(double _x, int _flag) {
    x = _x;
    flag = _flag;
  }
};
bool cmp1(POINT x, POINT y) {
  if (x.x == y.x) return x.y < y.y;
  return x.x < y.x;
}
POINT p[30], r[maxn], go[30];
LINESEG s[30];
node m[maxn * 2];
double x[maxn], y[maxn], vx[maxn], vy[maxn], ti[maxn][2], a[30];
int seg_seg(LINESEG l1, int targ, POINT &iter) {
  if (l1.e.x == l1.s.x) {
    double t = (l1.e.x - x[targ]) / vx[targ];
    if (t < 0) return 0;
    if (!vx[targ]) return 0;
    double hi = y[targ] + vy[targ] * t;
    if (hi >= min(l1.e.y, l1.s.y) && hi <= max(l1.e.y, l1.s.y)) {
      iter.x = l1.e.x;
      iter.y = hi;
      return 1;
    } else
      return 0;
  } else {
    double t = (l1.e.y - y[targ]) / vy[targ];
    if (t < 0) return 0;
    if (!vy[targ]) return 0;
    double hi = x[targ] + vx[targ] * t;
    if (hi >= min(l1.e.x, l1.s.x) && hi <= max(l1.e.x, l1.s.x)) {
      iter.x = hi;
      iter.y = l1.e.y;
      return 1;
    } else
      return 0;
  }
}
int check(LINESEG k, int targ) {
  int num = 0;
  if (x[targ] >= min(a[1], a[3]) && x[targ] <= max(a[1], a[3]) &&
      y[targ] >= min(a[2], a[4]) && y[targ] <= max(a[2], a[4])) {
    num = 1;
    go[1] = r[targ];
  }
  for (int i = 1; i <= 4; i++) {
    if (vx[targ] == 0)
      if (x[targ] == a[1] || x[targ] == a[3]) return 0;
    if (vy[targ] == 0)
      if (y[targ] == a[2] || y[targ] == a[4]) return 0;
    POINT tmp;
    if (seg_seg(s[i], targ, tmp)) {
      num++;
      go[num] = tmp;
    }
  }
  if (!num) return 0;
  int tot = 1;
  sort(go + 1, go + 1 + num, cmp1);
  for (int i = 2; i <= num; i++) {
    if (go[i].x != go[i - 1].x || go[i].y != go[i - 1].y) go[++tot] = go[i];
  }
  return tot == 2;
}
bool cmp(node x, node y) {
  if (x.x == y.x) return x.flag > y.flag;
  return x.x < y.x;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= 4; i++) scanf("%lf", &a[i]);
  p[1] = POINT(min(a[1], a[3]), min(a[2], a[4]));
  p[2] = POINT(max(a[1], a[3]), min(a[2], a[4]));
  p[3] = POINT(max(a[1], a[3]), max(a[2], a[4]));
  p[4] = POINT(min(a[1], a[3]), max(a[2], a[4]));
  s[1] = LINESEG(p[1], p[2]);
  s[2] = LINESEG(p[2], p[3]);
  s[3] = LINESEG(p[4], p[3]);
  s[4] = LINESEG(p[1], p[4]);
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf%lf%lf", &x[i], &y[i], &vx[i], &vy[i]);
    double nowx, nowy;
    nowx = x[i] + vx[i] * INF;
    nowy = y[i] + vy[i] * INF;
    r[i] = POINT(x[i], y[i]);
    POINT tmp1 = POINT(nowx, nowy);
    LINESEG z = LINESEG(tmp1, r[i]);
    if (!vx[i] && !vy[i]) {
      if (x[i] > min(a[1], a[3]) && x[i] < max(a[1], a[3]) &&
          y[i] > min(a[2], a[4]) && y[i] < max(a[2], a[4])) {
        ti[i][0] = 0;
        ti[i][1] = INF;
        continue;
      } else
        return 0 * printf("-1");
    }
    if (!check(z, i)) return 0 * printf("-1");
    if (vx[i]) {
      ti[i][0] = (go[1].x - x[i]) / vx[i];
      ti[i][1] = (go[2].x - x[i]) / vx[i];
    } else {
      ti[i][0] = (go[1].y - y[i]) / vy[i];
      ti[i][1] = (go[2].y - y[i]) / vy[i];
    }
    if (ti[i][0] > ti[i][1]) swap(ti[i][0], ti[i][1]);
    ti[i][0] += EP;
    ti[i][1] -= EP;
  }
  for (int i = 1; i <= n; i++) {
    m[i] = node(ti[i][0], 1);
    m[i + n] = node(ti[i][1], -1);
  }
  sort(m + 1, m + 1 + n * 2, cmp);
  int sum = 0;
  for (int i = 1; i <= 2 * n; i++) {
    sum += m[i].flag;
    if (sum == n) {
      printf("%.20lf", m[i].x);
      return 0;
    }
  }
  printf("-1");
  return 0;
}
