#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6;
int n, s, sum[2][N + 5];
vector<pair<int, int>> L, R;
inline long long calc(double x, double v, double t) {
  double d = (t - x / v) / ((1 / (v + s)) - (1 / v));
  return (x - d) / v * s + d;
}
inline bool check(double t) {
  int l, r;
  memset(sum, 0, sizeof(sum));
  for (auto& p : L) {
    if ((p.first * 1.0) / p.second <= t) {
      l = 0, r = N;
    } else {
      l = p.first, r = min(N, calc(p.first, p.second, t));
    }
    if (l <= r) {
      sum[0][l]++;
      sum[0][r + 1]--;
    }
  }
  for (auto& p : R) {
    if ((N - p.first * 1.0) / p.second <= t) {
      l = 0, r = N;
    } else {
      r = p.first, l = max(0LL, N - calc(N - p.first, p.second, t));
    }
    if (l <= r) {
      sum[1][l]++;
      sum[1][r + 1]--;
    }
  }
  for (int i = 1; i <= N; ++i) {
    sum[0][i] += sum[0][i - 1];
    sum[1][i] += sum[1][i - 1];
    if (sum[0][i] && sum[1][i]) return true;
  }
  return false;
}
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; ++i) {
    int x, v, t;
    scanf("%d %d %d", &x, &v, &t);
    (t == 1 ? L : R).push_back({x, v});
  }
  double l = 0, r = N, mid;
  for (int i = 0; i < 50; ++i) {
    mid = (l + r) / 2.0;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  printf("%0.10f", r);
  return 0;
}
