#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  double s;
  cin >> n >> s;
  vector<pair<double, double>> left, right;
  for (long long i = (long long)(1); i <= (long long)(n); i++) {
    long long x, v, d;
    cin >> x >> v >> d;
    if (d == 1) {
      left.push_back({x, v});
    } else {
      right.push_back({x, v});
    }
  }
  sort((left).begin(), (left).end());
  sort((right).begin(), (right).end());
  double END = (1e6);
  double start = 0, end = (1e10);
  while (fabs(start - end) > (1e-7)) {
    double mid = (start + end) / 2.0;
    vector<pair<double, double>> a, b;
    for (auto it : left) {
      double v = it.second;
      double pt = it.first;
      if ((pt / v) <= mid) {
        a.push_back({0, LONG_MAX});
        continue;
      }
      double r = ((mid * (s + v) * (s - v) - (s - v) * pt) / s) + 1.0 * pt;
      r = floor(r);
      if (pt <= r) a.push_back({pt, r});
    }
    for (auto it : right) {
      double v = it.second;
      double pt = it.first;
      if ((END - pt) / v <= mid) {
        b.push_back({0, LONG_MAX});
        continue;
      }
      double l = pt - ((mid * (s + v) * (s - v) - (s - v) * (END - pt)) / s);
      l = ceil(l);
      if (l <= pt) b.push_back({l, pt});
    }
    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());
    bool pos = false;
    while (!a.empty() && !b.empty()) {
      auto x = a.back(), y = b.back();
      if (x.first >= y.first && x.first <= y.second) {
        pos = true;
        break;
      } else if (y.first >= x.first && y.first <= x.second) {
        pos = true;
        break;
      }
      if (x.first > y.first) {
        b.pop_back();
      } else {
        a.pop_back();
      }
    }
    if (pos) {
      end = mid;
    } else {
      start = mid;
    }
  }
  cout << fixed << setprecision(6) << start;
}
