// Arup Guha
// Solution to 2017 NAQ Problem H: Imperfect GPS
// 10/7/2017

import java.util.*;

public class imperfectgps_arup {

	public static long[][] data;

	public static void main(String[] args) {

		// Read in the input.
		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		int period = stdin.nextInt();

		// Get the data.
		data = new long[n][3];
		for (int i=0; i<n; i++)
			for (int j=0; j<3; j++)
				data[i][j] = stdin.nextInt();

		// This is the real distance.
		double dist = 0;
		for (int i=1; i<n; i++)
			dist += getDist(data[i-1], data[i]);

		// Store GPS current point in cur.
		double[] cur = new double[2];
		cur[0] = data[0][0];
		cur[1] = data[0][1];
		long curT = period;
		double calc = 0;

		// Go through data again.
		for (int i=1; i<n; i++) {

			// Get the time interval for this segment.
			long t2 = data[i][2];

			// Just hop.
			while (curT <= t2) {

				// Get the next location and add in the distance.
				double[] pt = getPt(i, curT);
				calc += getDist(cur, pt);
				cur = pt;

				// Go to the next evaluation time.
				curT += period;
			}

			// Means we didn't do the very last hop (which is cut short)
			if (i == n-1 && curT < t2 + period)
				calc += getDist(cur, new double[]{data[n-1][0], data[n-1][1]});
		}

		System.out.println(100.0*(dist-calc)/dist);
	}

	// Gets the point at time curT which is on the segment from point i-1 to point i.
	public static double[] getPt(int i, long curT) {
		double ratio = (double)(curT-data[i-1][2])/(data[i][2]-data[i-1][2]);
		double[] res = new double[2];
		res[0] = data[i-1][0] + (data[i][0]-data[i-1][0])*ratio;
		res[1] = data[i-1][1] + (data[i][1]-data[i-1][1])*ratio;
		return res;
	}

	public static double getDist(long[] a, long[] b) {
		return Math.sqrt( (a[0]-b[0])*(a[0]-b[0]) + (a[1]-b[1])*(a[1]-b[1]) );
	}

	public static double getDist(double[] a, double[] b) {
		return Math.sqrt( (a[0]-b[0])*(a[0]-b[0]) + (a[1]-b[1])*(a[1]-b[1]) );
	}
}