#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
double s;
int n;
struct p {
  double x, v;
  int t;
} man[maxn];
bool jiao(pair<double, double> l, pair<double, double> r) {
  double ls = floor(l.second);
  double lf = ceil(l.first);
  double rs = floor(r.second);
  double rf = ceil(r.first);
  if (ls >= rf && lf <= rs) return true;
  if (rs >= lf && rf <= ls) return true;
  return false;
}
bool can(double time) {
  bool left = false, right = false;
  pair<double, double> l, r;
  l = r = make_pair(1e6 * 1.0, 0.0);
  for (int i = 0; i < n; i++) {
    double xx = man[i].x, vv = man[i].v;
    if (man[i].t == 1) {
      if (vv * time >= xx) {
        left = true;
        l = make_pair(0.0, 1e6 * 1.0);
      } else if ((vv + s) * time >= xx) {
        left = true;
        double t = (time * vv + time * s - xx) / s;
        double maxr = xx - vv * t + s * t;
        l.first = min(l.first, xx);
        l.second = max(l.second, maxr);
      }
    } else {
      if (vv * time >= 1e6 * 1.0 - xx) {
        right = true;
        r = make_pair(0.0, 1e6 * 1.0);
      } else if ((vv + s) * time >= 1e6 * 1.0 - xx) {
        right = true;
        double t = (s * time + vv * time - 1e6 * 1.0 + xx) / s;
        double maxl = xx + vv * t - s * t;
        r.first = min(r.first, maxl);
        r.second = max(r.second, xx);
      }
    }
    if (left && right && jiao(l, r)) {
      return true;
    }
  }
  return false;
}
int main() {
  scanf("%d%lf", &n, &s);
  for (int i = 0; i < n; i++)
    scanf("%lf%lf%d", &man[i].x, &man[i].v, &man[i].t);
  double l = 0.0, r = 1e6 * 1.0;
  for (int i = 0; i < 100; i++) {
    double m = (l + r) / 2.0;
    if (can(m))
      r = m;
    else
      l = m;
  }
  printf("%.7lf\n", l);
  return 0;
}
