#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class t, class u>
void chmax(t& first, u second) {
  if (first < second) first = second;
}
template <class t, class u>
void chmin(t& first, u second) {
  if (second < first) first = second;
}
template <class t>
using vc = vector<t>;
template <class t>
using vvc = vc<vc<t>>;
using pi = pair<ll, ll>;
using vi = vc<ll>;
template <class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
  return os << "{" << p.first << "," << p.second << "}";
}
template <class t>
ostream& operator<<(ostream& os, const vc<t>& v) {
  os << "{";
  for (auto e : v) os << e << ",";
  return os << "}";
}
using uint = unsigned;
using ull = unsigned long long;
template <ll i, class T>
void print_tuple(ostream&, const T&) {}
template <ll i, class T, class H, class... Args>
void print_tuple(ostream& os, const T& t) {
  if (i) os << ",";
  os << get<i>(t);
  print_tuple<i + 1, T, Args...>(os, t);
}
template <class... Args>
ostream& operator<<(ostream& os, const tuple<Args...>& t) {
  os << "{";
  print_tuple<0, tuple<Args...>, Args...>(os, t);
  return os << "}";
}
void print(ll x, ll suc = 1) {
  cout << x;
  if (suc == 1) cout << endl;
  if (suc == 2) cout << " ";
}
ll read() {
  ll i;
  cin >> i;
  return i;
}
vi readvi(ll n, ll off = 0) {
  vi v(n);
  for (ll i = ll(0); i < ll(n); i++) v[i] = read() + off;
  return v;
}
template <class T>
void print(const vector<T>& v, ll suc = 1) {
  for (ll i = ll(0); i < ll(v.size()); i++)
    print(v[i], i == ll(v.size()) - 1 ? suc : 2);
}
string readString() {
  string s;
  cin >> s;
  return s;
}
template <class T>
T sq(const T& t) {
  return t * t;
}
void yes(bool ex = true) {
  cout << "Yes" << endl;
  if (ex) exit(0);
}
void no(bool ex = true) {
  cout << "No" << endl;
  if (ex) exit(0);
}
constexpr ll ten(ll n) { return n == 0 ? 1 : ten(n - 1) * 10; }
const ll infLL = LLONG_MAX / 3;
const ll inf = infLL;
ll topbit(signed t) { return t == 0 ? -1 : 31 - __builtin_clz(t); }
ll topbit(ll t) { return t == 0 ? -1 : 63 - __builtin_clzll(t); }
ll popcount(signed t) { return __builtin_popcount(t); }
ll popcount(ll t) { return __builtin_popcountll(t); }
bool ispow2(ll i) { return i && (i & -i) == i; }
bool inc(ll first, ll second, ll c) { return first <= second && second <= c; }
template <class t>
void mkuni(vc<t>& v) {
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
}
ll rand_int(ll l, ll r) {
  static random_device rd;
  static mt19937 gen(rd());
  return uniform_int_distribution<ll>(l, r)(gen);
}
using ld = long double;
using cm = complex<ld>;
const ld eps = 1e-8;
const ld PI = acos(ld(-1));
ll sgn(ld first) { return first < -eps ? -1 : (first > eps ? 1 : 0); }
ld dot(cm first, cm second) {
  return first.real() * second.real() + first.imag() * second.imag();
}
ld crs(cm first, cm second) {
  return first.real() * second.imag() - first.imag() * second.real();
}
ld crs(cm first, cm second, cm c) { return crs(second - first, c - first); }
ll ccw(cm first, cm second) { return sgn(crs(first, second)); }
ll ccw(cm first, cm second, cm c) { return ccw(second - first, c - first); }
auto cmcmp = [](cm first, cm second) {
  ll s = sgn(first.real() - second.real());
  if (s)
    return s < 0;
  else
    return sgn(first.imag() - second.imag()) < 0;
};
bool cmeq(cm first, cm second) {
  return sgn(first.real() - second.real()) == 0 &&
         sgn(first.imag() - second.imag()) == 0;
};
ll argtype(cm first) {
  if (sgn(first.imag()) == 0) return first.real() < 0 ? 1 : 0;
  return first.imag() < 0 ? 0 : 1;
}
ll argcmp(cm first, cm second) {
  ll at = argtype(first), bt = argtype(second);
  if (at != bt) return at < bt ? -1 : 1;
  return -ccw(first, second);
};
bool argless(cm first, cm second) { return argcmp(first, second) < 0; }
ll bet(cm first, cm second, cm c) {
  cm d = second - first;
  ld e = dot(d, c - first);
  if (sgn(e) <= 0) return sgn(e) - 1;
  return sgn(e - norm(d)) + 1;
}
ll qeq(ld first, ld second, ld c, ld& d, ld& e) {
  ld f = second * second - 4 * first * c;
  if (sgn(f) < 0) return 0;
  ld g = sqrt(max(f, ld(0)));
  d = (-second + g) / (2 * first);
  e = (-second - g) / (2 * first);
  return sgn(f) + 1;
}
ll cont(cm first, cm second, cm c, cm d) {
  if (ccw(first, second, c) == -1) swap(second, c);
  return min({ccw(first, second, d), ccw(second, c, d), ccw(c, first, d)}) + 1;
}
ld arg(ld first, ld second, ld c) {
  return acos(
      min(max((first * first + second * second - c * c) / (2 * first * second),
              ld(-1)),
          ld(1)));
}
ld turn(cm first, cm second, cm c) {
  return arg((c - second) / (second - first));
}
using ln = pair<cm, cm>;
cm dir(ln first) { return first.second - first.first; }
cm eval(ln first, ld second) { return first.first + dir(first) * second; }
ll bet(ln first, cm second) { return bet(first.first, first.second, second); }
ll ccw(ln first, cm second) { return ccw(first.first, first.second, second); }
cm proj(ln first, cm second) {
  cm c = dir(first);
  return first.first + c * dot(c, second - first.first) / norm(c);
}
cm refl(ln first, cm second) { return ld(2) * proj(first, second) - second; }
ld dsp(ln first, cm second) {
  cm c = proj(first, second);
  if (abs(bet(first.first, first.second, c)) <= 1) return abs(second - c);
  return min(abs(second - first.first), abs(second - first.second));
}
ll iss(ln first, ln second) {
  ll c1 = ccw(first.first, first.second, second.first),
     c2 = ccw(first.first, first.second, second.second);
  ll d1 = ccw(second.first, second.second, first.first),
     d2 = ccw(second.first, second.second, first.second);
  if (c1 || c2 || d1 || d2) return 1 - max(c1 * c2, d1 * d2);
  ll f = bet(first.first, first.second, second.first),
     g = bet(first.first, first.second, second.second);
  if (max(f, g) == -2 || min(f, g) == 2) return 0;
  return 3;
}
cm cll(ln first, ln second) {
  return eval(first, crs(second.first, second.second, first.first) /
                         crs(dir(first), dir(second)));
}
ld dss(ln first, ln second) {
  if (iss(first, second)) return 0;
  return min({dsp(first, second.first), dsp(first, second.second),
              dsp(second, first.first), dsp(second, first.second)});
}
ln vbis(cm first, cm second) {
  cm c = (first + second) * ld(0.5), d = second - first;
  return ln(c, cm(c.real() - d.imag(), c.imag() + d.real()));
}
bool ips(const vc<cm>& first, ln second) {
  ll n = first.size();
  for (ll i = ll(0); i < ll(n); i++) {
    cm c = first[(i + n - 1) % n], d = first[i], e = first[(i + 1) % n];
    if (iss(ln(c, d), second) == 2) return 1;
    if (ccw(second, d) == 0 && bet(second.first, second.second, d) == 0) {
      if (ccw(c, d, e) == 1) return 1;
      if (ccw(second, c) * ccw(second, e) < 0) return 1;
    }
  }
  return 0;
}
ll cont(const vc<cm>& first, cm second) {
  ll n = first.size();
  ll res = 0;
  for (ll i = ll(0); i < ll(n); i++) {
    cm c = first[i], d = first[(i + 1) % n];
    if (ccw(c, d, second) == 0 && abs(bet(c, d, second)) <= 1) return 1;
    if (c.imag() > d.imag()) swap(c, d);
    if (sgn(second.imag() - c.imag()) > 0 &&
        sgn(d.imag() - second.imag()) >= 0 && ccw(c, d, second) == 1)
      res ^= 1;
  }
  return res * 2;
}
ld area2(const vc<cm>& first) {
  ll n = first.size();
  ld second = 0;
  for (ll i = ll(0); i < ll(n); i++)
    second += crs(first[i], first[(i + 1) % n]);
  return second;
}
vc<cm> convex(vc<cm> s) {
  swap(s[0], *min_element(s.begin(), s.end(), cmcmp));
  sort(s.begin() + 1, s.end(), [&](cm first, cm second) {
    ll c = ccw(s[0], first, second);
    if (c)
      return c == 1;
    else
      return bet(s[0], first, second) == 2;
  });
  vc<cm> t;
  for (ll i = ll(0); i < ll(s.size()); i++) {
    ll ss;
    while ((ss = t.size()) >= 2) {
      cm first = t[ss - 2];
      cm second = t[ss - 1];
      cm c = s[i];
      if (ccw(first, second, c) > 0) break;
      t.pop_back();
    }
    t.push_back(s[i]);
  }
  return t;
}
vc<cm> halfpint(vc<ln> s) {
  sort(s.begin(), s.end(), [&](ln first, ln second) {
    ll c = argcmp(dir(first), dir(second));
    if (c) return c < 0;
    return ccw(second, first.first) > 0;
  });
  s.erase(unique(s.begin(), s.end(),
                 [&](ln first, ln second) {
                   return argcmp(dir(first), dir(second)) == 0;
                 }),
          s.end());
  ll n = s.size();
  vi cur;
  for (ll ii = ll(0); ii < ll(n * 2); ii++) {
    ll i = ii % n, m;
    while ((m = cur.size()) >= 2) {
      if (ccw(s[i], cll(s[cur[m - 2]], s[cur[m - 1]])) > 0) break;
      cur.pop_back();
    }
    cur.push_back(i);
  }
  vi cnt(n);
  for (auto i : cur) cnt[i]++;
  vc<ln> t;
  for (ll i = ll(0); i < ll(n); i++)
    if (cnt[i] == 2) t.push_back(s[i]);
  ll m = t.size();
  vc<cm> res(m);
  for (ll i = ll(0); i < ll(m); i++) res[i] = (cll(t[i], t[(i + 1) % m]));
  return res;
}
vc<cm> ccut(vc<cm> first, ln second) {
  ll n = first.size();
  vc<cm> c;
  for (ll i = ll(0); i < ll(n); i++) {
    ll j = (i + 1) % n;
    ll d = ccw(second, first[i]), e = ccw(second, first[j]);
    if (d >= 0) c.push_back(first[i]);
    if (d * e < 0) c.push_back(cll(second, ln(first[i], first[j])));
  }
  return c;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
  ll n, w, h;
  cin >> n >> w >> h;
  map<ll, vc<cm>> z;
  ll e1, e2;
  cin >> e1 >> e2;
  cm st(e1, e2);
  for (ll i = ll(0); i < ll(n); i++) {
    ll t, first, second;
    cin >> t >> first >> second;
    z[t].push_back(cm(first, second));
  }
  auto ch = [&](ln& first, ln second) {
    if (ccw(second, first.first) < 0 && ccw(second, first.second) < 0)
      return false;
    else {
      if (ccw(second, first.first) < 0) first.first = cll(first, second);
      if (ccw(second, first.second) < 0) first.second = cll(first, second);
      return true;
    }
  };
  vc<pair<ll, ln>> ps;
  ln bd[4]{ln(cm(0, 0), cm(w, 0)), ln(cm(w, 0), cm(w, w)),
           ln(cm(w, w), cm(0, w)), ln(cm(0, w), cm(0, 0))};
  for (auto kv : z) {
    vc<cm> first = kv.second;
    for (auto second : first) {
      ps.emplace_back(kv.first,
                      ln(cm(0, second.real() / second.imag() * h),
                         cm(second.real() / (h - second.imag()) * h, 0)));
      for (ll k = ll(0); k < ll(4); k++) ch(ps.back().second, bd[k]);
    }
  }
  auto chk = [&](ld m) {
    ln cur(st, st);
    ll last = 0;
    for (ll i = ll(0); i < ll(n); i++) {
      ln nx = ps[i].second;
      ld v = m * (ps[i].first - last);
      if (!cmeq(cur.first, cur.second)) {
        if (!ch(nx, ln(cur.first + cm(-v, -v), cur.second + cm(-v, -v))))
          return false;
        if (!ch(nx, ln(cur.second + cm(v, v), cur.first + cm(v, v))))
          return false;
      }
      if (!ch(nx, ln(cm(cur.first.real() - v, w), cm(cur.first.real() - v, 0))))
        return false;
      if (!ch(nx,
              ln(cm(cur.second.real() + v, 0), cm(cur.second.real() + v, w))))
        return false;
      if (!ch(nx, ln(cm(w, cur.first.imag() + v), cm(0, cur.first.imag() + v))))
        return false;
      if (!ch(nx,
              ln(cm(0, cur.second.imag() - v), cm(w, cur.second.imag() - v))))
        return false;
      cur = nx;
      last = ps[i].first;
    }
    void(0);
    return true;
  };
  ld mn = 0, mx = 1002;
  for (ll _ = ll(0); _ < ll(30); _++) {
    ld mid = (mn + mx) / 2;
    if (chk(mid))
      mx = mid;
    else
      mn = mid;
  }
  if (mx > 1001)
    cout << -1 << endl;
  else
    cout << mn << endl;
}
