#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
int n, t;
double w, h;
double a, b;
double x, y;
struct P {
  double x, y;
  double operator*(const P &a) const { return x * a.y - a.x * y; }
  P operator-(const P &a) const { return (P){x - a.x, y - a.y}; }
};
vector<vector<P> > tim(100001);
vector<vector<double> > event;
vector<double> cur;
bool check() {
  for (int i = 0; i < 1e5; i++) {
    if (!tim[i].size()) continue;
    while (tim[i].size() > 1) {
      int sz = tim[i].size();
      if (tim[i][sz - 1].x == tim[i][sz - 2].x &&
          tim[i][sz - 1].y == tim[i][sz - 2].y)
        tim[i].pop_back();
      else
        break;
    }
    reverse(tim[i].begin(), tim[i].end());
    if (tim[i].size() == 1)
      event.push_back({tim[i][0].x, tim[i][0].y, (double)i, 0});
    else {
      for (int j = 2; j < (int)tim[i].size(); j++) {
        if (abs((tim[i][j] - tim[i][0]) * (tim[i][j] - tim[i][1])) > eps)
          return 0;
      }
      P cur = tim[i][0], lar = tim[i][1];
      if (abs(cur.y - lar.y) < eps) return 0;
      double u = lar.x + (lar.x - cur.x) * (h - lar.y) / (lar.y - cur.y);
      double v = lar.x - lar.y * (lar.x - cur.x) / (lar.y - cur.y);
      if (u < -eps || u > w + eps || v < -eps || v > w + eps) return 0;
      event.push_back({u, v, (double)i, 1});
    }
  }
  return 1;
}
bool solve(double v) {
  for (int i = 0; i < (int)event.size(); i++) {
    vector<double> rev = event[i];
    double s = (event[i][2] - cur.back()) * v;
    if (abs(rev.back()) > eps) {
      if (cur.size() == 3) {
        if (abs(rev[0] - cur[0]) > s || abs(rev[1] - cur[1]) > s)
          return 0;
        else
          cur = {rev[0], rev[1], rev[2]};
      } else {
        double u2 = rev[0], d2 = rev[1], l = cur[0], r = cur[1], x1 = cur[2],
               y1 = cur[3];
        if (max(l, max(u2 - s, ((d2 + s) * (y1 - h) + x1 * h) / y1)) >
            min(r, min(u2 + s, ((d2 - s) * (y1 - h) + x1 * h) / y1)))
          return 0;
        else
          cur = {u2, d2, rev[2]};
      }
    } else {
      if (cur.size() == 3) {
        double u1 = cur[0], d1 = cur[1], x2 = rev[0], y2 = rev[1];
        double l =
            max(max((double)0, u1 - s), max(((d1 + s) * (y2 - h) + x2 * h) / y2,
                                            (x2 * h + w * (y2 - h)) / y2));
        double r = min(min(w, u1 + s),
                       min(x2 * h / y2, ((d1 - s) * (y2 - h) + x2 * h) / y2));
        if (l > r)
          return 0;
        else
          cur = {l, r, x2, y2, rev[2]};
      } else {
        double l = cur[0], r = cur[1], x1 = cur[2], y1 = cur[3], x2 = rev[0],
               y2 = rev[1];
        double a = y2 * (y1 - h) / ((y2 - h) * y1),
               b = (y1 - h) * ((x1 * h) / (y1 - h) - (x2 * h) / (y2 - h)) / y1;
        double l0 = max(l - s, (l - b + s * (y1 - h) / y1) / a),
               r0 = min(r + s, (r - b - s * (y1 - h) / y1) / a);
        l0 = max(l0, max((double)0, (x2 * h - w * (h - y2)) / y2));
        r0 = min(r0, min(w, x2 * h / y2));
        if (y1 != y2) {
          double c = min((s - s * (y1 - h) / y1 - b) / (a - 1),
                         (-s + s * (y1 - h) / y1 - b) / (a - 1));
          double d = max((s - s * (y1 - h) / y1 - b) / (a - 1),
                         (-s + s * (y1 - h) / y1 - b) / (a - 1));
          l0 = max(l0, c);
          r0 = min(r0, d);
        }
        if (l0 > r0) return 0;
        cur = {l0, r0, x2, y2, rev[2]};
      }
    }
  }
  return 1;
}
int main() {
  cout.precision(15);
  scanf("%d", &n);
  scanf("%lf %lf %lf %lf", &w, &h, &b, &a);
  cur = {a, b, (double)0};
  for (int i = 0; i < n; i++) {
    scanf("%d", &t);
    scanf("%lf %lf", &x, &y);
    tim[t].push_back((P){x, y});
  }
  if (!check()) {
    printf("-1");
    return 0;
  }
  double lo = 0, hi = 1e4;
  while (abs(hi - lo) > 1e-6) {
    double mid = (hi + lo) / 2;
    bool ok = solve(mid);
    if (ok)
      hi = mid;
    else
      lo = mid;
    cur = {a, b, (double)0};
  }
  cout << hi;
  return 0;
}
