#include <bits/stdc++.h>
using namespace std;
int n;
long long x[100000], v[100000];
int dir[100000];
long long s;
bool possible(long double t) {
  vector<pair<long long, long long>> segments;
  for (int i = 0; i < (n); i++) {
    if (dir[i] == 1) {
      long long p =
          (long long)((long double)((s + v[i]) * (s - v[i]) * t + v[i] * x[i]) /
                      (s));
      if ((long double)x[i] / v[i] <= t)
        segments.push_back(make_pair(0, 1000000));
      else if (p >= x[i])
        segments.push_back(make_pair(x[i], p));
    }
  }
  for (int i = 0; i < (n); i++) {
    if (dir[i] == 2) {
      long long p =
          1000000 - (long long)((long double)((s + v[i]) * (s - v[i]) * t +
                                              v[i] * (1000000 - x[i])) /
                                (s));
      if ((long double)(1000000 - x[i]) / v[i] <= t)
        return segments.size();
      else if (p <= x[i]) {
        for (const pair<long long, long long> segment : segments) {
          if (p <= segment.second && x[i] >= segment.first) return true;
        }
      }
    }
  }
  return false;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (int i = 0; i < (n); i++) cin >> x[i] >> v[i] >> dir[i];
  long double lo = 0;
  long double hi = 1000000;
  for (int counter = 0; counter < (45); counter++) {
    long double mid = (lo + hi) / 2;
    if (possible(mid)) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  cout << fixed << setprecision(12) << lo << "\n";
  return 0;
}
