#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
A cvt(B x) {
  stringstream ss;
  ss << x;
  A y;
  ss >> y;
  return y;
}
int n, s;
int x[100000], v[100000], dir[100000];
void rev() {
  for (int i = 0; i < (int)(n); i++) {
    x[i] = 1000000 - x[i];
    dir[i] ^= 1;
  }
}
vector<pair<long long, long long> > check(double t) {
  vector<pair<long long, long long> > intervals;
  for (int i = 0; i < (int)(n); i++)
    if (dir[i] == 0) {
      double ti = 1.0 * x[i] / v[i];
      if (ti <= t) {
        intervals.push_back({0, 1000000});
      } else {
        double dc = ti * (s - v[i]);
        double d = (s - v[i]) * (s * t + t * v[i] - x[i]) / s;
        if (d < 0 || d > dc) continue;
        intervals.push_back({x[i], (int)min(x[i] + d, 1000000.0)});
      }
    }
  return intervals;
}
int f[1000001], g[1000001];
int main() {
  scanf("%d %d", &n, &s);
  for (int i = 0; i < (int)(n); i++) {
    scanf("%d %d %d", &x[i], &v[i], &dir[i]);
    dir[i]--;
  }
  double t0 = 0, t1 = 1e6;
  for (int it = 0; it < (int)(50); it++) {
    double t = (t0 + t1) / 2.0;
    vector<pair<long long, long long> > l = check(t);
    rev();
    vector<pair<long long, long long> > r = check(t);
    rev();
    memset(f, 0, sizeof(f));
    for (pair<long long, long long> &p : l) {
      f[p.first]++;
      f[p.second + 1]--;
    }
    memset(g, 0, sizeof(g));
    for (pair<long long, long long> &p : r) {
      g[1000000 - p.first + 1]--;
      g[1000000 - p.second]++;
    }
    int ok = 0;
    for (int i = (1); i <= (1000000); i++) {
      f[i] += f[i - 1];
      g[i] += g[i - 1];
      if (f[i] > 0 && g[i] > 0) ok = 1;
    }
    if (!ok) {
      t0 = t;
    } else {
      t1 = t;
    }
  }
  printf("%.9f\n", t1);
  return 0;
}
