#include <bits/stdc++.h>
using namespace std;
const int sze = 1e6;
int main() {
  int n, s;
  vector<pair<int, int>> left, right;
  scanf("%d%d", &n, &s);
  for (int i = 0; i < n; i++) {
    int x, v, t;
    scanf("%d%d%d", &x, &v, &t);
    if (t == 1)
      left.push_back(make_pair(x, v));
    else
      right.push_back(make_pair(x, v));
  }
  long double lb = 0, rb = sze;
  for (int i = 0; i < 50; i++) {
    long double m = (rb + lb) / 2;
    vector<pair<long double, long double>> pos1, pos2;
    bool startl = 0, startr = 0;
    for (auto challenger : left) {
      if (!startl && (challenger.first - challenger.second * m) <= 0)
        startl = 1;
      long double t1 = ((challenger.second + s) * m - challenger.first) / s;
      if (t1 < 0)
        continue;
      else
        pos1.push_back(make_pair(
            challenger.first, challenger.first + (s - challenger.second) * t1));
    }
    for (auto challenger : right) {
      if (!startr && (sze - challenger.first - challenger.second * m) <= 0)
        startr = 1;
      long double t1 =
          ((challenger.second + s) * m - (sze - challenger.first)) / s;
      if (t1 < 0)
        continue;
      else
        pos2.push_back(make_pair(
            challenger.first - (s - challenger.second) * t1, challenger.first));
    }
    if ((startl && (startr || pos2.size())) ||
        (startr && (startl || pos1.size())))
      rb = m;
    else {
      pair<int, int> cnt[sze + 2];
      for (int i = 0; i < sze + 2; i++) cnt[i] = make_pair(0, 0);
      for (auto boder : pos1) {
        cnt[(int)min(max((long double)0, ceil(boder.first)), (long double)sze)]
            .first += 1;
        cnt[(int)min(max((long double)0, floor(boder.second) + 1),
                     (long double)sze)]
            .first -= 1;
      }
      for (auto boder : pos2) {
        cnt[(int)min(max((long double)0, ceil(boder.first)), (long double)sze)]
            .second += 1;
        cnt[(int)min(max((long double)0, floor(boder.second) + 1),
                     (long double)sze)]
            .second -= 1;
      }
      bool label = 0;
      for (int i = 0; i <= sze; i++) {
        if (i) {
          cnt[i].first += cnt[i - 1].first;
          cnt[i].second += cnt[i - 1].second;
        }
        if (cnt[i].first && cnt[i].second) label = 1;
      }
      if (label)
        rb = m;
      else
        lb = m;
    }
  }
  cout << fixed << setprecision(6) << rb;
  return 0;
}
