#include <bits/stdc++.h>
using namespace std;
const int N = 100002, MX = 1000000;
int n;
double second, x[N], v[N], t[N];
bool intersect(int i, int j, int x, int y) {
  if (i > y or j < x) return false;
  return true;
}
int rightMost(int i, double tm) {
  int l = x[i], r = MX;
  while (l < r) {
    int y = (l + r) / 2 + 1;
    if ((y - x[i]) / (second - v[i]) +
            (x[i] - (v[i] * (y - x[i])) / (second - v[i])) / (second + v[i]) <=
        tm)
      l = y;
    else
      r = y - 1;
  }
  return l;
}
int leftMost(int i, double tm) {
  int l = 0, r = x[i];
  while (l < r) {
    int y = (l + r) / 2;
    if ((x[i] - y) / (second - v[i]) +
            (MX - x[i] - (v[i] * (x[i] - y)) / (second - v[i])) /
                (second + v[i]) <=
        tm)
      r = y;
    else
      l = y + 1;
  }
  return l;
}
bool check(double tm) {
  int l = MX, r = 0;
  for (int i = (1); i <= (int)(n); ++i)
    if (t[i] == 1) {
      if (x[i] / v[i] <= tm) {
        l = 0, r = MX;
        break;
      }
      if (x[i] / (v[i] + second) > tm) continue;
      int y = rightMost(i, tm);
      l = min(l, (int)x[i]);
      r = max(r, y);
    }
  if (l > r) return false;
  for (int i = (1); i <= (int)(n); ++i)
    if (t[i] == 2) {
      if ((MX - x[i]) / v[i] <= tm) return true;
      if ((MX - x[i]) / (v[i] + second) > tm) continue;
      int y = leftMost(i, tm);
      if (intersect(l, r, y, x[i])) return true;
    }
  return false;
}
int main() {
  cin >> n >> second;
  for (int i = (1); i <= (int)(n); ++i) cin >> x[i] >> v[i] >> t[i];
  double l = 0, r = 1e12;
  while (r - l > 1e-8) {
    double mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid;
  }
  printf("%.6f", l);
}
