#include <bits/stdc++.h>
using namespace std;
const int inf = (int)1e9;
const long long linf = (long long)1e18;
const double eps = (double)1e-8;
const int mod = (int)1e9 + 7;
const int maxn = (int)1e5 + 5;
int n, s, x[maxn], v[maxn], dir[maxn];
pair<int, int> dzen(double d, double v, double t, double s) {
  if (d / v <= t) return make_pair(0, (int)1e6);
  double d1 = (t - d / (v + s)) / (1. / v - 1. / (v + s));
  long long xr = d1 / v * s + d - d1;
  long long xl = d;
  if (xl > xr)
    return make_pair(-1, -1);
  else
    return make_pair(xl, min((long long)1e6, xr));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (int i = (1); i <= (int)(n); ++i) {
    cin >> x[i] >> v[i] >> dir[i];
  }
  double l, r;
  l = 0;
  r = 1e6;
  for (int(iter) = (1); (iter) <= (int)(200); ++(iter)) {
    double mid = (l + r) / 2;
    int fl = 0;
    vector<pair<pair<int, int>, int> > vc;
    for (int i = (1); i <= (int)(n); ++i) {
      if (dir[i] == 1) {
        pair<int, int> seg = dzen(x[i], v[i], mid, s);
        if (seg != make_pair(-1, -1))
          vc.push_back(make_pair(make_pair(seg.first, 1), seg.second));
      } else {
        int tox = (int)1e6 - x[i];
        pair<int, int> seg = dzen(tox, v[i], mid, s);
        if (seg != make_pair(-1, -1)) {
          seg.first = (int)1e6 - seg.first;
          seg.second = (int)1e6 - seg.second;
          vc.push_back(make_pair(make_pair(seg.second, 2), seg.first));
        }
      }
    }
    sort(vc.begin(), vc.end());
    int gr1 = -1;
    int gr2 = -1;
    for (int i = (0); i < (int)(vc.size()); ++i) {
      if (vc[i].first.second == 1) {
        gr1 = max(gr1, vc[i].second);
        if (gr2 >= vc[i].first.first) {
          fl = 1;
          break;
        }
      } else {
        gr2 = max(gr2, vc[i].second);
        if (gr1 >= vc[i].first.first) {
          fl = 1;
          break;
        }
      }
    }
    if (!fl)
      l = mid;
    else
      r = mid;
  }
  cout << fixed << setprecision(15);
  cout << r << "\n";
  return 0;
}
