#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
const double eps = 1e-6;
int n, s;
struct node {
  int x, v, d;
  node(int y = 0, int _v = 0, int c = 0) : x(y), v(_v), d(c){};
} f[maxn];
vector<pair<int, int> > g[2], w;
bool check(double t) {
  g[0].clear();
  g[1].clear();
  for (int i = 0; i < n; i++) {
    if (f[i].d == 1) {
      if (f[i].v * t + eps > f[i].x)
        g[0].push_back(pair<int, int>(0.0, 1e6));
      else {
        if ((s + f[i].v) * t + eps < f[i].x) continue;
        double r =
            1.0 * (t * (s + f[i].v) / s - 1.0 * f[i].x / s) * (s - f[i].v) +
            f[i].x;
        int u = min(r, 1e9);
        if (f[i].x > u) continue;
        g[0].push_back(pair<int, int>(f[i].x, u));
      }
    } else {
      if (f[i].v * t - eps + f[i].x > 1e6)
        g[1].push_back(pair<int, int>(0.0, 1e6));
      else {
        if ((s + f[i].v) * t + eps + f[i].x < 1e6) continue;
        double r =
            1.0 * (t * (s + f[i].v) / s - (1e6 - f[i].x) / s) * (s - f[i].v) +
            1e6 - f[i].x;
        int u = min(r, 1e9);
        if (1e6 - u > f[i].x) continue;
        g[1].push_back(pair<int, int>(1e6 - u, f[i].x));
      }
    }
  }
  if (g[0].size() == 0 || g[1].size() == 0) return false;
  sort(g[0].begin(), g[0].end());
  sort(g[1].begin(), g[1].end());
  w.clear();
  int m = g[0].size();
  int l, r;
  l = g[0][0].first;
  r = g[0][0].second;
  for (int i = 1; i < m; i++) {
    if (g[0][i].first <= r)
      r = max(r, g[0][i].second);
    else {
      w.push_back(pair<int, int>(l, r));
      l = g[0][i].first;
      r = g[0][i].second;
    }
  }
  w.push_back(pair<int, int>(l, r));
  m = g[1].size();
  l = g[1][0].first;
  r = g[1][0].second;
  for (int i = 1; i < m; i++) {
    if (g[1][i].first <= r)
      r = max(r, g[1][i].second);
    else {
      w.push_back(pair<int, int>(l, r));
      l = g[1][i].first;
      r = g[1][i].second;
    }
  }
  w.push_back(pair<int, int>(l, r));
  sort(w.begin(), w.end());
  m = w.size();
  for (int i = 1; i < m; i++) {
    if (w[i].first <= w[i - 1].second) return true;
  }
  return false;
}
int main() {
  scanf("%d%d", &n, &s);
  double l = 0.0, r = 1e6;
  for (int i = 0; i < n; i++) scanf("%d%d%d", &f[i].x, &f[i].v, &f[i].d);
  for (int i = 0; i < 100; i++) {
    double mid = (l + r) * 0.5;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  printf("%.8f\n", r);
  return 0;
}
