#include <bits/stdc++.h>
using namespace std;
struct vec {
  double x, y;
  vec() {}
  vec(double a, double b) { x = a, y = b; }
  double mod() { return x * x + y * y; }
  void W() { printf("%lf %lf !\n", x, y); }
} a[1 << 20];
vec operator+(vec a, vec b) { return vec(a.x + b.x, a.y + b.y); }
vec operator-(vec a, vec b) { return vec(a.x - b.x, a.y - b.y); }
double operator*(vec a, vec b) { return a.x * b.x + a.y * b.y; }
double operator^(vec a, vec b) { return a.x * b.y - a.y * b.x; }
vec operator*(vec a, double b) { return vec(a.x * b, a.y * b); }
const double eps = 1e-9;
struct lin {
  vec p, v;
  lin() {}
  lin(vec a, vec b) { p = a, v = b; }
};
vec operator*(lin a, lin b) {
  double mu = ((b.p - a.p) ^ b.v) / (a.v ^ b.v);
  return a.p + a.v * mu;
}
int n, w, h, e1, e2;
int t[1 << 20];
bool IN(vec a, vec b, vec c) { return (c - a) * (c - b) < eps; }
bool INL(lin a, vec p) { return fabs(a.v ^ (p - a.p)) < eps; }
vec u[123];
bool bok[123];
bool test(vec a) {
  return a.x > -eps && a.y > -eps && w - a.x > -eps && w - a.y > -eps;
}
bool OK(double vv, int st, int ed, vec p1) {
  lin now(p1, vec(0, 0));
  for (int i = st; i <= ed; i++) {
    double A = -(h - a[i].y), B = -a[i].y, C = a[i].x * h;
    lin l;
    if (a[i].y) {
      l.p = vec(1, -(A + C) / B);
      l.v = vec(0, -C / B);
    } else {
      l.p = vec(-(B + C) / A, 1);
      l.v = vec(-C / A, 0);
    }
    l.v = l.v - l.p;
    if (t[i] == t[i - 1]) {
      if (fabs(now.v ^ l.v) < eps) return INL(l, now.p);
      return IN(now.p, now.p + now.v, now * l);
    }
    int tp = 4;
    double lim = vv * (t[i] - t[i - 1]);
    if (lim > w) lim = w;
    vec d1 = now.p, d2 = now.p + now.v;
    if (d1.x > d2.x) swap(d1, d2);
    if (fabs(d1.x - d2.x) < eps) {
      if (d1.y > d2.y) swap(d1, d2);
      u[1] = d1 + vec(-lim, -lim);
      u[2] = d1 + vec(lim, -lim);
      u[3] = d2 + vec(lim, lim);
      u[4] = d2 + vec(-lim, lim);
    } else if (fabs(d1.y - d2.y) < eps) {
      u[1] = d1 + vec(-lim, lim);
      u[2] = d1 + vec(-lim, -lim);
      u[3] = d2 + vec(lim, -lim);
      u[4] = d2 + vec(lim, lim);
    } else {
      tp = 6;
      if (d1.y < d2.y) {
        u[1] = d1 + vec(-lim, lim);
        u[2] = d1 + vec(-lim, -lim);
        u[3] = d1 + vec(lim, -lim);
        u[4] = d2 + vec(lim, -lim);
        u[5] = d2 + vec(lim, lim);
        u[6] = d2 + vec(-lim, lim);
      } else {
        u[1] = d1 + vec(lim, lim);
        u[2] = d1 + vec(-lim, lim);
        u[3] = d1 + vec(-lim, -lim);
        u[4] = d2 + vec(-lim, -lim);
        u[5] = d2 + vec(lim, -lim);
        u[6] = d2 + vec(lim, lim);
      }
    }
    u[tp + 1] = u[1];
    vec p1(2e19, 2e19), p2(2e19, 2e19);
    for (int j = 1; j <= tp + 1; j++) bok[j] = INL(l, u[j]);
    for (int j = 1; j <= tp; j++)
      if (bok[j] && bok[j + 1]) {
        p1 = u[j], p2 = u[j + 1];
        break;
      }
    if (p1.x > 1e19) {
      for (int j = 1; j <= tp; j++)
        if (bok[j]) {
          if (p1.x > 1e9)
            p1 = u[j];
          else
            p2 = u[j];
        }
    }
    if (p2.x > 1e19) {
      for (int j = 1; j <= tp; j++) {
        if (bok[j] || bok[j + 1] || fabs((u[j + 1] - u[j]) ^ l.v) < eps)
          continue;
        vec res = lin(u[j], u[j + 1] - u[j]) * l;
        if (IN(u[j], u[j + 1], res)) {
          if (p1.x > 1e19)
            p1 = res;
          else
            p2 = res;
        }
      }
    }
    if (p2.x > 1e19) p2 = p1;
    int fl = 0;
    if (fabs(p1.y - p2.y) < eps) fl = 1, swap(p1.x, p1.y), swap(p2.x, p2.y);
    if (fabs(p1.x - p2.x) < eps) {
      if (p1.x < -eps || p1.x - w > eps) return 0;
      if (p1.y > p2.y) swap(p1, p2);
      if (p2.y < -eps || p1.y - w > eps) return 0;
      p1.y = max(p1.y, 0.0);
      p2.y = min(p2.y, 1.0 * w);
    } else {
      if (p1.x > p2.x) swap(p1, p2);
      double kk = (p2.y - p1.y) / (p2.x - p1.x);
      double v1 = p1.x - p1.y / kk, v2 = p1.x + (w - p1.y) / kk;
      double sl = max(0.0, p1.x), sr = min(1.0 * w, p2.x);
      sl = max(sl, min(v1, v2)), sr = min(sr, max(v1, v2));
      if (sl - sr > eps) return 0;
      p1 = vec(sl, kk * (sl - p1.x) + p1.y);
      p2 = vec(sr, kk * (sr - p1.x) + p1.y);
    }
    if (fl) fl = 1, swap(p1.x, p1.y), swap(p2.x, p2.y);
    now = lin(p1, p2 - p1);
  }
  return 1;
}
double Get(int st, int ed) {
  vec p1;
  if (!st)
    p1 = vec(e1, e2);
  else {
    lin nw(a[st], a[st + 1] - a[st]);
    p1.x = (nw * lin(vec(0, 0), vec(1, 0))).x;
    p1.y = (nw * lin(vec(0, h), vec(1, 0))).x;
  }
  double l = 0, r = 2e3;
  while (r - l > 1e-6) {
    double mid = (l + r) / 2.0;
    if (OK(mid, st == 0 ? 1 : st + 2, ed, p1))
      r = mid;
    else
      l = mid;
  }
  return (l + r) / 2.0;
}
pair<pair<int, int>, int> cc[1 << 20];
int main() {
  scanf("%d%d%d%d%d", &n, &w, &h, &e1, &e2);
  for (int i = 1; i <= n; i++)
    scanf("%d%d%d", &cc[i].first.first, &cc[i].first.second, &cc[i].second);
  sort(cc + 1, cc + n + 1);
  n = unique(cc + 1, cc + n + 1) - cc - 1;
  for (int i = 1; i <= n; i++)
    t[i] = cc[i].first.first, a[i] = vec(cc[i].first.second, cc[i].second);
  double als = 0;
  int lst = 0;
  for (int i = 1, j; i <= n; i = j + 1) {
    for (j = i; t[j + 1] == t[i]; j++)
      ;
    if (j - i >= 1) {
      if (a[i].y == a[i + 1].y) return 0 & puts("-1");
      for (int k = i + 2; k <= j; k++)
        if (fabs((a[j] - a[i]) ^ (a[j] - a[i + 1])) > eps)
          return 0 & puts("-1");
      als = max(als, Get(lst, i + 1));
      lst = j - 1;
    }
  }
  als = max(als, Get(lst, n));
  if (als > 1500)
    puts("-1");
  else
    printf("%.6lf\n", als);
  return 0;
}
