#include <bits/stdc++.h>
using namespace std;
const int MX = 1000000;
const double EPS = 0.00000001;
const double EPS2 = 0.000000001;
long long x[MX + 7], v[MX + 7], dir[MX + 7], dist[MX + 7];
long long n, s;
bool can(double t) {
  int good[2] = {false, false};
  vector<pair<long long, long long>> info;
  for (int i = 0; i < n; ++i) {
    if (v[i] * t >= dist[i])
      ++good[dir[i]];
    else if ((v[i] + s) * t < dist[i])
      continue;
    else {
      double d1 = t * v[i] * (v[i] + s) - dist[i] * v[i];
      d1 /= s;
      double tm = d1 / v[i];
      double d = dist[i] + (s - v[i]) * tm;
      if (dir[i] == 0) {
        info.push_back(make_pair(x[i], 0));
        info.push_back(make_pair((long long)(d + EPS2), 2));
      } else {
        info.push_back(make_pair(MX - (long long)(d + EPS2), 1));
        info.push_back(make_pair(x[i], 3));
      }
    }
  }
  sort(info.begin(), info.end());
  for (auto q : info) {
    if (good[0] > 0 && good[1] > 0) return true;
    if (q.second < 2)
      ++good[q.second];
    else
      --good[q.second - 2];
  }
  return (good[0] > 0 && good[1] > 0);
}
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> v[i] >> dir[i];
    --dir[i];
    if (dir[i] == 0)
      dist[i] = x[i];
    else
      dist[i] = MX - x[i];
  }
  double l = 0, r = MX;
  while (r - l > EPS) {
    double m = (l + r) / 2;
    if (can(m))
      r = m;
    else
      l = m;
  }
  cout.precision(10);
  cout << l;
  return 0;
}
