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:
/*
 * Author Ayub Subhaniya
 * Institute DA-IICT
 */

import java.io.*;
import java.math.*;
import java.text.DecimalFormat;
import java.util.*;

public class  Codeforces427{
	
	InputStream in;
	PrintWriter out;
	
	Pair left[],right[];
	double s;
	int n1,n2;
	double MAX=(double)1e6;
	void solve() {
		int n=ni();
		s=nd();
		left=new Pair[n];
		right=new Pair[n];
		
		n1=n2=0;
		double x,v;
		int t;
		for (int i=0;i<n;i++)
		{
			x=nd();v=nd();t=ni();
			if (t==1)
				left[n1++]=new Pair(x,v);
			else
				right[n2++]=new Pair(x,v);
		}
		
		double left=0,right=MAX,result;
		result=-1;
		for (int i=0;i<100;i++)
		{
			double mid=(left+right)/2.0;

			if (check(mid))
			{
				result=mid;
				right=mid;
			}
			else
				left=mid;
		}

		out.println(result);
	}
	
	
	class Pair{
		double x;
		double y;

		Pair(double a, double b) {
			x = a;
			y = b;
		}
	}
	
	class Segment implements Comparable<Segment> {
		double s;
		double e;

		Segment(double a, double b) {
			s = a;
			e = b;
		}

		@Override
		public int compareTo(Segment o) {
			if (e == o.e)
				return Double.compare(s, o.s);
			else
				return Double.compare(e, o.e);
		}

	}
	
	
	
	boolean check(double t)
	{
		double t1,pnt,tdash,tmp;
		Segment lt[],rt[];
		lt=new Segment[n1];
		rt=new Segment[n2];
		int idx1=0,idx2=0;
		for (int i=0;i<n1;i++)
		{
			tmp=left[i].x/(left[i].y+s);
			if (tmp>t)
				continue;
			
			tdash=left[i].x/left[i].y;
			
			if (tdash<=t)
			{
				lt[0]=new Segment(1, MAX-1);
				idx1=1;
				break;
			}
			t1=((s+left[i].y)*t-left[i].x)/s;
			
			pnt=t*(s+left[i].y)-t1*(left[i].y);
			lt[idx1++]=new Segment(left[i].x, (long)pnt);
		}
		
		for (int i=0;i<n2;i++)
		{
			tmp=(MAX-right[i].x)/(right[i].y+s);
			if (tmp>t)
				continue;
			
			tdash=(MAX-right[i].x)/right[i].y;
			
			if (tdash<=t)
			{
				rt[0]=new Segment(1, MAX-1);
				idx2=1;
				break;
			}
			
			t1=((s+right[i].y)*t-(MAX-right[i].x))/s;
			
			pnt=MAX-t*(s+right[i].y)+t1*(right[i].y);
			rt[idx2++]=new Segment((long)Math.ceil(pnt),right[i].x);
		}
		Arrays.sort(lt,0,idx1);
		Arrays.sort(rt,0,idx2);
		
		int i=0,j=0;
		while (i<idx1&&j<idx2)
		{
			if (lt[i].e>rt[j].e)
			{
				if (rt[j].e>=lt[i].s)
					return true;
				else
					j++;
			}
			else if (lt[i].e<rt[j].e)
			{
				if (lt[i].e>=rt[j].s)
					return true;
				else
					i++;
			}
			else
				return true;
		}
		return false;
	}	
	
	void run() throws Exception {
		String INPUT = "C:/Users/ayubs/Desktop/input.txt";
		in = oj ? System.in : new FileInputStream(INPUT);
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis() - s + "ms");
	
	}
	public static void main(String[] args) throws Exception {
		new Codeforces427().run();
	}
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = in.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean inSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}
	
	private int skip() {
		int b;
		while ((b = readByte()) != -1 && inSpaceChar(b))
			;
		return b;
	}
	
	private double nd() {
		return Double.parseDouble(ns());
	}
	
	private char nc() {
		return (char) skip();
	}
	
	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(inSpaceChar(b))) { // when nextLine, (inSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(inSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	
	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		
		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		
		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	
	private void tr(Object... o) {
		if (!oj)
			System.out.println(Arrays.deepToString(o));
	}
	
}