#include <bits/stdc++.h>
using namespace std;
const int bnd = (int)1e6;
int s;
bool can(double tm, int bomb, int dist, int v) {
  double reach = (double)bomb / (double)(s - v);
  if (reach > tm) return false;
  if (reach * v >= dist) return true;
  double tans = reach + (dist - reach * v) / (s + v);
  return tans <= tm;
}
int getmax(double tm, int dist, int v) {
  int l = 0, r = bnd;
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (can(tm, m, dist, v))
      l = m;
    else
      r = m;
  }
  return l;
}
bool check(double tm, const vector<int> &x, const vector<int> &v,
           const vector<int> &t) {
  const int n = (int)(x).size();
  vector<vector<pair<int, int> > > segs(2);
  for (int i = 0; i < (int)(n); ++i) {
    int dist = (t[i] == 0 ? x[i] : bnd - x[i]);
    if (tm * v[i] >= dist) {
      segs[t[i]].push_back(make_pair(0, bnd));
      continue;
    }
    if (tm * (v[i] + s) < dist) continue;
    int len = getmax(tm, dist, v[i]);
    if (t[i] == 0)
      segs[t[i]].push_back(make_pair(x[i], min(bnd, x[i] + len)));
    else
      segs[t[i]].push_back(make_pair(max(0, x[i] - len), x[i]));
  }
  vector<vector<int> > cnt(2, vector<int>(bnd + 2));
  for (int i = 0; i < (int)(2); ++i)
    for (const auto &p : segs[i]) {
      cnt[i][p.first]++;
      cnt[i][p.second + 1]--;
    }
  for (int i = 0; i < (int)(2); ++i)
    for (int j = 0; j < (int)(bnd + 2); ++j)
      if (j) cnt[i][j] += cnt[i][j - 1];
  for (int j = 0; j < (int)(bnd + 2); ++j)
    if (cnt[0][j] && cnt[1][j]) return true;
  return false;
}
void solve(int n) {
  cin >> s;
  vector<int> x(n), v(n), t(n);
  for (int i = 0; i < (int)(n); ++i) {
    cin >> x[i] >> v[i] >> t[i];
    --t[i];
  }
  double l = 0, r = 1e6;
  for (int it = 0; it < (int)(45); ++it) {
    double m = (l + r) / 2;
    if (check(m, x, v, t))
      r = m;
    else
      l = m;
  }
  printf("%.15f\n", (double)r);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  while (cin >> n) solve(n);
}
