#include <bits/stdc++.h>
using namespace std;
struct Point {
  double x, y;
  Point() {
    x = 0;
    y = 0;
  }
  Point(double a, double b) {
    x = a;
    y = b;
  }
};
struct vec {
  double x, y;
};
struct Line {
  double a, b, c;
};
double ppdist(Point a, Point b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
bool samept(Point A, Point B) {
  double a = A.x - B.x;
  double b = A.y - B.y;
  if (abs(a) < 1e-10 && abs(b) < 1e-10) return true;
  return false;
}
vec createVect(Point a, Point b) {
  vec p;
  p.x = b.x - a.x;
  p.y = b.y - a.y;
  return p;
}
double dot(vec a, vec b) { return a.x * b.x + a.y * b.y; }
double cross(vec a, vec b) { return a.x * b.y - a.y * b.x; }
double length(vec a) { return sqrt(pow(a.x, 2) + pow(a.y, 2)); }
double lpdist(Point a, Point b, Point c) {
  vec AB = createVect(a, b), AC = createVect(a, c), BC = createVect(b, c),
      BA = createVect(b, a);
  if (dot(AB, BC) > 0) return ppdist(c, b);
  if (dot(BA, AC) > 0) return ppdist(a, c);
  return abs(cross(AB, AC) / (length(AB)));
}
double areapoly(Point A[], int n) {
  double ans = 0;
  for (int i = 1; i < n - 1; i++) {
    vec a = createVect(A[0], A[i]);
    vec b = createVect(A[0], A[i + 1]);
    ans += cross(a, b);
  }
  return abs(ans / 2.0);
}
Line genline(Point a, Point b) {
  Line x;
  x.a = b.y - a.y;
  x.b = a.x - b.x;
  x.c = x.a * a.x + x.b * a.y;
  return x;
}
bool insideCircle(Point cent, double rad, Point A) {
  if ((rad - ppdist(cent, A)) > 1e-10) return false;
  return true;
}
bool oncircle(Point cent, double rad, Point A) {
  if (abs(rad - ppdist(cent, A)) < 1e-10) return true;
  return false;
}
Point twopointsrad(Point A, Point B, double r) {
  double s = pow(ppdist(A, B), 2);
  double d = sqrt(r * r / s - 0.25);
  if (d < 0) return Point(1e9 + 1, 1e9 + 1);
  return Point((A.x + B.x) / 2.0 + (A.y - B.y) * d,
               (A.y + B.y) / 2.0 + (B.x - A.x) * d);
}
bool arepar(Line A, Line B) {
  double d = A.a * B.b - B.a * A.b;
  if (abs(d) < 1e-10) {
    return true;
  }
  return false;
}
bool checkint(Line A, Line B) {
  double d = A.a * B.b - B.a * A.b;
  if (abs(d) < 1e-10) {
    return false;
  }
  return true;
}
Point findint(Line A, Line B) {
  Point ans;
  double d = A.a * B.b - B.a * A.b;
  if (abs(d) < 1e-10) {
    ans.x = -1;
    ans.y = -1;
  } else {
    double p = B.b * A.c - A.b * B.c;
    double q = A.a * B.c - B.a * A.c;
    ans.x = p / d;
    ans.y = q / d;
  }
  return ans;
}
double findangle(Point a, Point b, Point c) {
  vec x = createVect(a, b);
  vec y = createVect(b, c);
  return acos(dot(x, y) / (length(x) * length(y)));
}
Point getpoint(Line A) {
  double x = 1;
  double y = (A.c - A.a * x) / A.b;
  return Point(x, y);
}
Point findcentre(Point A, Point B, Point C) {
  Line p = genline(A, B), q = genline(B, C);
  Line j, k;
  j.a = -1 * p.b;
  j.b = p.a;
  j.c = j.a * (A.x + B.x) / 2.0 + j.b * (A.y + B.y) / 2.0;
  k.a = -1 * q.b;
  k.b = q.a;
  k.c = k.a * (B.x + C.x) / 2.0 + k.b * (B.y + C.y) / 2.0;
  return findint(j, k);
}
Point findmirror(Point A, Line P) {
  Line p = P, j;
  j.a = -1 * p.b;
  j.b = p.a;
  j.c = j.a * A.x + j.b * A.y;
  Point d = findint(P, j);
  Point ans;
  ans.x = 2 * d.x - A.x;
  ans.y = 2 * d.y - A.y;
  return ans;
}
Point rotate(Point A, double degree) {
  double rad = (degree * 3.1415926535897932384626433832795028841 / 180.0);
  Point ans;
  ans.x = A.x * cos(rad) - A.y * sin(rad);
  ans.y = A.x * sin(rad) + A.y * cos(rad);
  return ans;
}
int visited[100001];
vector<Point> convhull(Point A[], int n, int coll) {
  double p = 1e9 + 1, q = -1 * 1e9 + 1;
  int f = -1;
  vector<Point> ans;
  memset(visited, 0, sizeof(visited));
  for (int i = 0; i < n; i++) {
    if (A[i].x <= p) {
      if (A[i].x == p)
        if (A[i].y > q) continue;
      p = A[i].x;
      q = A[i].y;
      f = i;
    }
  }
  int j = f;
  int beg = j;
  do {
    double dist;
    int k = -1;
    if (coll)
      dist = 1e9 + 1;
    else
      dist = 0;
    for (int i = 0; i < n; i++) {
      if (i == j) continue;
      if (visited[i]) continue;
      if (k == -1) k = i;
      double d = ppdist(A[i], A[j]);
      double cr = cross(createVect(A[j], A[i]), createVect(A[j], A[k]));
      if (cr < 0) {
        k = i;
        dist = d;
      } else if (!cr) {
        if (coll && d < dist) {
          k = i;
          dist = d;
        }
        if (!coll && d > dist) {
          k = i;
          dist = d;
        }
      }
    }
    j = k;
    visited[j] = 1;
    ans.push_back(A[j]);
  } while (beg != j);
  return ans;
}
bool collinear(Point A, Point B, Point C) {
  double area = A.x * (B.y - C.y) + B.x * (C.y - A.y) + C.x * (A.y = B.y);
  if (abs(area) < 1e-10) return true;
  return false;
}
Point piv;
bool mycomp(Point& A, Point& B) {
  if (collinear(A, B, piv)) {
    return ppdist(A, piv) < ppdist(B, piv);
  }
  return (atan((A.y - piv.y) / (A.x - piv.x)) -
          atan((B.y - piv.y) / (B.x - piv.x))) < 0;
}
vector<Point> GrahamCH(Point A[], int n) {
  vector<Point> ans;
  if (n <= 3) {
    for (int i = 0; i < n; i++) ans.push_back(A[i]);
    ans.push_back(A[0]);
    return ans;
  }
  int ind = -1;
  double p = -1 * 1e9 + 1, q = 1e9 + 1;
  for (int i = 0; i < n; i++) {
    if (A[i].y <= q) {
      if (A[i].y == q)
        if (A[i].x < p) continue;
      p = A[i].x;
      q = A[i].y;
      ind = i;
    }
  }
  Point temp = A[ind];
  A[ind] = A[0];
  A[0] = temp;
  piv = A[0];
  sort(A + 1, A + n, mycomp);
  ans.push_back(A[n - 1]);
  ans.push_back(A[0]);
  ans.push_back(A[1]);
  int i = 2;
  while (i < n) {
    int x = ans.size() - 1;
    cout << x << "\n";
    if (cross(createVect(ans[x], A[i]), createVect(ans[x], ans[x - 1])) >
        1e-10) {
      ans.push_back(A[i]);
      i++;
    } else
      ans.pop_back();
  }
  return ans;
}
bool geteq(double a, double b) { return abs(a - b) < 1e-10; }
double rx[100010], ry[100010], vx[100010], vy[100010];
Line val[100010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  double x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  for (int i = 0; i < n; i++) {
    cin >> rx[i] >> ry[i] >> vx[i] >> vy[i];
    val[i] = genline(Point(rx[i], ry[i]), Point(rx[i] + vx[i], ry[i] + vy[i]));
  }
  Line A[4];
  A[0] = genline(Point(x1, y1), Point(x1, y2));
  A[1] = genline(Point(x1, y2), Point(x2, y2));
  A[2] = genline(Point(x2, y2), Point(x2, y1));
  A[3] = genline(Point(x2, y1), Point(x1, y1));
  vector<pair<double, double> > rngs;
  for (int i = 0; i < n; i++) {
    vector<Point> df;
    if (abs(vx[i]) < 1e-10 && abs(vy[i]) < 1e-10) {
      if (rx[i] > x1 && rx[i] < x2 && ry[i] > y1 && ry[i] < y2) {
        rngs.push_back(make_pair(0, 1e18));
        continue;
      } else {
        cout << -1 << '\n';
        return 0;
      }
    }
    for (int j = 0; j < 4; j++) {
      if (checkint(val[i], A[j])) {
        Point temp = findint(val[i], A[j]);
        if (temp.x > x1 - 1e-10 && x2 > temp.x - 1e-10 && temp.y > y1 - 1e-10 &&
            y2 > temp.y - 1e-10) {
          int mk = 0;
          for (int k = 0; k < 4; k++) {
            if (!checkint(val[i], A[k])) {
              if (abs(val[i].a) < 1e-10 &&
                  (abs(ry[i] - y1) < 1e-10 || abs(ry[i] - y2) < 1e-10))
                mk = 1;
              if (abs(val[i].b) < 1e-10 &&
                  (abs(rx[i] - x1) < 1e-10 || abs(rx[i] - x2) < 1e-10))
                mk = 1;
            }
          }
          if (!mk) df.push_back(temp);
        }
      }
    }
    vector<Point> ins;
    int pres[4] = {0};
    for (int j = 0; j < df.size(); j++) {
      if (!pres[j]) {
        for (int k = j + 1; k < df.size(); k++) {
          if (abs(df[j].x - df[k].x) < 1e-10 && abs(df[j].y - df[k].y) < 1e-10)
            pres[k] = 1;
        }
        ins.push_back(df[j]);
      }
    }
    if (ins.size() < 2) {
      cout << -1 << '\n';
      return 0;
    } else {
      double t1, t2;
      if (abs(vx[i]) > 1e-10) {
        t1 = (ins[0].x - rx[i]) / vx[i];
        t2 = (ins[1].x - rx[i]) / vx[i];
      } else if (abs(vy[i]) > 1e-10) {
        t1 = (ins[0].y - ry[i]) / vy[i];
        t2 = (ins[1].y - ry[i]) / vy[i];
      } else {
        t1 = 0;
        t2 = 1e18;
      }
      if (t1 > t2 + 1e-10) swap(t1, t2);
      if (t1 < 0) {
        t1 = 0;
      }
      if (abs(t2) > 0) {
        t2 -= 1e-10;
        t1 += 1e-10;
        rngs.push_back(make_pair(t1, t2));
      } else {
        cout << -1 << '\n';
        return 0;
      }
    }
  }
  double maxi = -1e18, mini = 1e18;
  for (int i = 0; i < n; i++) {
    maxi = max(maxi, rngs[i].first);
    mini = min(mini, rngs[i].second);
  }
  if (mini > maxi - 1e-10) {
    printf("%.17lf\n", maxi);
  } else
    cout << -1 << '\n';
}
