#include <bits/stdc++.h>
using namespace std;
int n, s, x, v, t, y, i, nr1, nr2, v1[100004], v2[100004], c[1000004],
    d[1000004];
long long st, dr, m, Min, Min1, x1, x2, a[100004], b[100004];
double nr;
bool ok;
int main() {
  scanf("%d %d", &n, &s);
  for (i = 1; i <= n; i++) {
    scanf("%d %d %d", &x, &v, &t);
    if (t == 1) {
      a[++nr1] = (1LL) * x * 5000000;
      v1[nr1] = v;
    } else {
      b[++nr2] = (1LL) * 1000000 * 5000000 - (1LL) * x * 5000000;
      v2[nr2] = v;
    }
  }
  st = 1;
  dr = (1LL) * 1000000 * 5000000;
  for (i = 1; i <= 1000000; i++) c[i] = 0;
  while (st <= dr) {
    m = (1LL) * ((0LL) + st + dr) / 2;
    ok = false;
    for (i = 1; i <= nr1; i++) {
      x1 = (0LL) + a[i] - (1LL) * v1[i] * m;
      if (x1 > 0) {
        x2 = (1LL) * x1 / s;
        if (((1LL) * x1 % s) != 0) x2 = (1LL) + x2;
        x2 = (0LL) + m - x2;
        if (x2 >= 0) {
          x1 = (0LL) + a[i] + (1LL) * x2 * (s - v1[i]);
          if (((1LL) * a[i] % 5000000) == 0)
            c[(1LL) * a[i] / 5000000]++;
          else
            c[(1LL) * a[i] / 5000000 + 1]++;
          if (((1LL) * x1 / 5000000) <= 1000000) c[(1LL) * x1 / 5000000 + 1]--;
        }
      } else
        c[1]++;
    }
    for (i = 1; i <= nr2 && ok == false; i++) {
      x1 = (0LL) + b[i] - (1LL) * v2[i] * m;
      if (x1 > 0) {
        x2 = (1LL) * x1 / s;
        if (((1LL) * x1 % s) != 0) x2 = (1LL) + x2;
        x2 = (0LL) + m - x2;
        if (x2 >= 0) {
          x1 = (0LL) + ((1LL) * 5000000 * 1000000 - b[i]) -
               (1LL) * x2 * (s - v2[i]);
          d[(1LL) * ((1LL) * 5000000 * 1000000 - b[i]) / 5000000 + 1]--;
          if ((((1LL) * x1 % 5000000) == 0) && (x1 > 0))
            d[(1LL) * x1 / 5000000]++;
          else if ((((1LL) * x1 % 5000000) != 0) && (x1 > 0))
            d[(1LL) * x1 / 5000000 + 1]++;
          else
            d[1]++;
        }
      } else
        d[1]++;
    }
    if (ok == false) {
      x = 0;
      y = 0;
      for (i = 1; i <= 1000000; i++) {
        x += c[i];
        y += d[i];
        if (x > 0 && y > 0) ok = true;
        c[i] = 0;
        d[i] = 0;
      }
    }
    if (ok == false)
      st = (0LL) + m + 1;
    else
      dr = (0LL) + m - 1;
  }
  nr = (1.0) * st / 5000000;
  printf("%.10f", nr);
  return 0;
}
