#include <bits/stdc++.h>
using namespace std;
const int M = 1000000;
int S, f[M + 1], g[M + 1];
vector<pair<int, int> > le, ri;
inline int get(double x, double v, double s, double t) {
  long long val1 = s * x / v;
  long long val2 = (t * (s * s - v * v) + x * v) / s;
  return min({M * 1LL, val1, val2});
}
inline bool check(double T) {
  memset(f, 0, sizeof(f));
  memset(g, 0, sizeof(g));
  for (auto pp : le) {
    int x = pp.first;
    int v = pp.second;
    if (x <= v * T) {
      f[0]++;
      continue;
    }
    int lo = x;
    int hi = get(x, v, S, T);
    if (lo <= hi) {
      f[lo]++;
      if (hi + 1 <= M) f[hi + 1]--;
    }
  }
  for (auto pp : ri) {
    int x = pp.first;
    int v = pp.second;
    if (M - x <= v * T) {
      g[0]++;
      continue;
    }
    int hi = x;
    int lo = M - get(M - x, v, S, T);
    if (lo <= hi) {
      g[lo]++;
      if (hi + 1 <= M) g[hi + 1]--;
    }
  }
  if (f[0] && g[0]) return true;
  for (int i = 1; i <= M; i++) {
    f[i] += f[i - 1];
    g[i] += g[i - 1];
    if (f[i] && g[i]) return true;
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n >> S;
  for (int i = 0; i < n; i++) {
    int x, v, t;
    cin >> x >> v >> t;
    if (t == 1) {
      le.push_back({x, v});
    } else {
      ri.push_back({x, v});
    }
  }
  double lo = 0.0, hi = 1e6;
  for (int iter = 0; iter < 60; iter++) {
    double mi = (lo + hi) / 2;
    if (check(mi))
      hi = mi;
    else
      lo = mi;
  }
  cout << setprecision(30) << (lo + hi) / 2 << '\n';
  return 0;
}
