Problem: n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed.

You can put a bomb in some point with non-negative integer coordinate, and blow it up. At this moment all people will start running with their maximum speed in the direction they are facing. Also, two strange rays will start propagating from the bomb with speed s: one to the right, and one to the left. Of course, the speed s is strictly greater than people's maximum speed.

The rays are strange because if at any moment the position and the direction of movement of some ray and some person coincide, then the speed of the person immediately increases by the speed of the ray.

You need to place the bomb is such a point that the minimum time moment in which there is a person that has run through point 0, and there is a person that has run through point 106, is as small as possible. In other words, find the minimum time moment t such that there is a point you can place the bomb to so that at time moment t some person has run through 0, and some person has run through point 106.

Input

The first line contains two integers n and s (2 ≤ n ≤ 105, 2 ≤ s ≤ 106) — the number of people and the rays' speed.

The next n lines contain the description of people. The i-th of these lines contains three integers xi, vi and ti (0 < xi < 106, 1 ≤ vi < s, 1 ≤ ti ≤ 2) — the coordinate of the i-th person on the line, his maximum speed and the direction he will run to (1 is to the left, i.e. in the direction of coordinate decrease, 2 is to the right, i.e. in the direction of coordinate increase), respectively.

It is guaranteed that the points 0 and 106 will be reached independently of the bomb's position.

Output

Print the minimum time needed for both points 0 and 106 to be reached.

Your answer is considered correct if its absolute or relative error doesn't exceed 10 - 6. Namely, if your answer is a, and the jury's answer is b, then your answer is accepted, if <image>.

Examples

Input

2 999
400000 1 2
500000 1 1


Output

500000.000000000000000000000000000000


Input

2 1000
400000 500 1
600000 500 2


Output

400.000000000000000000000000000000

Note

In the first example, it is optimal to place the bomb at a point with a coordinate of 400000. Then at time 0, the speed of the first person becomes 1000 and he reaches the point 106 at the time 600. The bomb will not affect on the second person, and he will reach the 0 point at the time 500000.

In the second example, it is optimal to place the bomb at the point 500000. The rays will catch up with both people at the time 200. At this time moment, the first is at the point with a coordinate of 300000, and the second is at the point with a coordinate of 700000. Their speed will become 1500 and at the time 400 they will simultaneously run through points 0 and 106.

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;

/*
 public class _832C {

 }

 */

public class _832C
{
	double max = 1000000;

	class people
	{
		int x;
		int v;
		int t;

		public people(int x, int v, int t)
		{
			super();
			this.x = x;
			this.v = v;
			this.t = t;
		}

	}

	public void solve() throws FileNotFoundException
	{
		InputStream inputStream = System.in;

		InputHelper inputHelper = new InputHelper(inputStream);

		PrintStream out = System.out;

		// actual solution
		int n = inputHelper.readInteger();
		int s = inputHelper.readInteger();

		people[] pa = new people[n];

		for (int i = 0; i < n; i++)
		{
			int x = inputHelper.readInteger();
			int v = inputHelper.readInteger();
			int t = inputHelper.readInteger();

			pa[i] = new people(x, v, t);
		}

		double lo = 0.0;
		double hi = max;

		double ans = max;

		for (int i = 0; i < 50; i++)
		{
			double mid = (lo + hi) / 2;

			if (isok(pa, mid, s))
			{
				hi = mid;
				ans = Math.min(ans, mid);
			}
			else
			{
				lo = mid;
			}
		}

		System.out.println(ans);
		// end here
	}

	class segment
	{
		double s;
		double e;

		public segment(double s, double e)
		{
			super();
			this.s = s;
			this.e = e;
		}

	}

	boolean isok(people[] pa, double t, double s)
	{
		List<segment> sl1 = new ArrayList<_832C.segment>();

		for (int i = pa.length - 1; i >= 0; i--)
		{
			if (pa[i].t == 2)
			{
				double x = max - pa[i].x;
				double v = pa[i].v;

				if (x / v <= t)
				{
					sl1.add(new segment(0, max));
					break;
				}

				int n = (int) Math.floor(((t - (x / (s + v))) * (s - v))
						/ (1 - (v / (s + v))));
				if (n >= 0)
					sl1.add(new segment(Math.max(pa[i].x - n, 0), pa[i].x));
			}
		}

		sl1 = compressSegment(sl1);

		List<segment> sl2 = new ArrayList<_832C.segment>();

		for (int i = 0; i < pa.length; i++)
		{
			if (pa[i].t == 1)
			{
				double x = pa[i].x;
				double v = pa[i].v;

				if (x / v <= t)
				{
					sl2.add(new segment(0, max));
					break;
				}

				int n = (int) Math.floor(((t - (x / (s + v))) * (s - v))
						/ (1 - (v / (s + v))));

				if (n >= 0)
					sl2.add(new segment(x, Math.min(x + n, max)));
			}
		}

		sl2 = compressSegment(sl2);

		boolean[] sa1 = new boolean[1000001];

		for (int i = 0; i < sl1.size(); i++)
		{
			segment seg = sl1.get(i);

			for (int j = (int) seg.s; j <= (int) seg.e; j++)
			{
				sa1[j] = true;
			}
		}

		for (int i = 0; i < sl2.size(); i++)
		{
			segment seg = sl2.get(i);

			for (int j = (int) seg.s; j <= (int) seg.e; j++)
			{
				if (sa1[j])
					return true;
			}
		}

		return false;
	}

	List<segment> compressSegment(List<segment> sl)
	{
		if (sl.size() == 0)
			return sl;

		sl.sort((s1, s2) ->
		{
			double n1 = s1.e - s1.s;
			double n2 = s2.e - s2.s;

			if (s1.s == s2.s)
				return (int) (n2 - n1);
			else
				return (int) (s1.s - s2.s);
		});

		List<segment> fsl = new ArrayList<_832C.segment>();

		fsl.add(sl.get(0));

		int lai = 0;

		for (int i = 1; i < sl.size(); i++)
		{
			if (sl.get(i).e <= fsl.get(lai).e)
			{
				continue;
			}

			if (sl.get(i).s <= fsl.get(lai).e)
			{
				fsl.add(new segment(fsl.get(lai).e + 1, sl.get(i).e));
			}
			else
			{
				fsl.add(sl.get(i));
			}

			lai = fsl.size() - 1;
		}

		return fsl;
	}

	public static void main(String[] args) throws FileNotFoundException
	{
		(new _832C()).solve();
	}

	class InputHelper
	{
		StringTokenizer tokenizer = null;
		private BufferedReader bufferedReader;

		public InputHelper(InputStream inputStream)
		{
			InputStreamReader inputStreamReader = new InputStreamReader(
					inputStream);
			bufferedReader = new BufferedReader(inputStreamReader, 16384);
		}

		public String read()
		{
			while (tokenizer == null || !tokenizer.hasMoreTokens())
			{
				try
				{
					String line = bufferedReader.readLine();
					if (line == null)
					{
						return null;
					}
					tokenizer = new StringTokenizer(line);
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}

			return tokenizer.nextToken();
		}

		public Integer readInteger()
		{
			return Integer.parseInt(read());
		}

		public Long readLong()
		{
			return Long.parseLong(read());
		}
	}
}