#include <bits/stdc++.h>
using namespace std;
vector<pair<double, double> > A, B;
int Left[1000010];
int Right[1000010];
int s;
bool call(double t) {
  memset(Left, 0, sizeof(Left));
  memset(Right, 0, sizeof(Right));
  for (int i = 0; i < A.size(); i++)
    if ((double)A[i].first / (double)(A[i].second + s) <= t) {
      if ((double)A[i].first / (double)(A[i].second) <= t) {
        Left[0]++;
        continue;
      }
      Left[(long long int)A[i].first]++;
      double d1 = t * A[i].second * (A[i].second + s);
      d1 -= A[i].first * A[i].second;
      d1 /= s;
      double x = d1 * s / A[i].second;
      x += ((double)A[i].first) - d1;
      long long int nx = floor(x);
      nx = min(nx, 1000000ll);
      nx = max(nx, (long long int)A[i].first);
      Left[nx + 1]--;
    }
  for (int i = 0; i < B.size(); i++)
    if ((double)B[i].first / (double)(B[i].second + s) <= t) {
      if ((double)B[i].first / (double)(B[i].second) <= t) {
        Right[0]++;
        continue;
      }
      Right[(long long int)B[i].first]++;
      double d1 = t * B[i].second * (B[i].second + s);
      d1 -= B[i].first * B[i].second;
      d1 /= s;
      double x = d1 * s / B[i].second;
      x += ((double)B[i].first) - d1;
      long long int nx = floor(x);
      nx = min(nx, 1000000ll);
      nx = max(nx, (long long int)B[i].first);
      Right[nx + 1]--;
    }
  for (int i = 1; i <= 1000000; i++) Left[i] += Left[i - 1];
  for (int i = 1; i <= 1000000; i++) Right[i] += Right[i - 1];
  for (int i = 0; i < 1000001; i++)
    if (Left[i] && Right[1000000 - i]) {
      return true;
    }
  return false;
}
int main() {
  int n;
  scanf("%d %d", &n, &s);
  int x = 1000000, y = 0;
  for (int i = 0; i < n; i++) {
    double a, b;
    int c;
    scanf("%lf %lf %d", &a, &b, &c);
    if (c == 1)
      A.push_back(make_pair(a, b));
    else {
      a = 1000000 - a;
      B.push_back(make_pair(a, b));
    }
  }
  double L = 0, R = 1000000, mid, ans = 100000000.0;
  for (int k = 0; k < 60; k++) {
    mid = (L + R) / 2.0;
    if (call(mid))
      ans = mid, R = mid;
    else
      L = mid;
  }
  printf("%.8lf\n", ans);
  return 0;
}
