#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct node {
  long long x, v, d;
} a[N];
int n, s;
long long mod = 1e9 + 7, P = 1000000;
double eps = 1e-9;
bool check(double x) {
  long long l1 = P + 1, r1 = 0, l2 = P + 1, r2 = 0;
  for (int i = 0; i < n; i++) {
    if (a[i].d == 1) {
      if (a[i].v * x >= a[i].x)
        l1 = 0, r1 = P;
      else if ((a[i].v + s) * x >= a[i].x) {
        l1 = min(l1, a[i].x);
        r1 = max(r1, a[i].x + (long long)((s * x + a[i].v * x - a[i].x) *
                                          (s - a[i].v)) /
                                  s);
      }
    } else {
      if (a[i].v * x >= P - a[i].x)
        l2 = 0, r2 = P;
      else if ((a[i].v + s) * x >= P - a[i].x) {
        r2 = max(r2, a[i].x);
        l2 = min(l2, a[i].x - (long long)((s * x + a[i].v * x - P + a[i].x) *
                                          (s - a[i].v)) /
                                  s);
      }
    }
  }
  if (l1 > r2 || l2 > r1)
    return 0;
  else
    return 1;
}
int main() {
  scanf("%d%d", &n, &s);
  for (int i = 0; i < n; i++) scanf("%lld%lld%lld", &a[i].x, &a[i].v, &a[i].d);
  double l = 0, r = P, ans;
  for (int i = 0; i < 100; i++) {
    double mid = (l + r) / 2;
    if (check(mid)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  printf("%.10lf", ans);
  return 0;
}
