eolymp
bolt
Try our new interface for solving problems

Jam

The most annoying thing in Moscow traffic jams is that drivers constantly try to suddenly change lanes in order to move faster. In this problem you'll have to find out whether this is a reasonable strategy or not.

We'll study a relatively simple mathematical model of a traffic jam. Assume that there's an n-lane road, lanes numbered from 1 to n, and i-th lane is moving with speed bi + ai * sin(t + deltai) at the moment t. It is always true that bi > ai, i.e., the speed of movement is always positive. You can change the lane you're in at any time, it takes c * |x - y| to change from x-th lane to y-th. We'll assume that you're not moving forward during that period.

Determine the time you need to travel the distance of d, and the method of achieving that time. You're starting at the moment 0 at lane 1, you may finish at any lane.

Input

The first line contains two integers n and d and a floating-point number c (1n5, 1d1000, 0.001c1000). The next n lines describe lanes, each containing two integers ai and bi and a floating-point number deltai (0ai < bi100, 0deltai < 2 * pi).

Output

On the first line print the minimal time required to travel the distance of d. On the second line print the number k of lane changes required to do that. k should not be more than 106, it is guaranteed that there always exists an optimal strategy requiring not more than 106 lane changes. On the next k lines print the changes themselves, each line should contain the new lane number and the time when the change is started. The changes should be printed in chronological order. If there're many possible schedules, output any.

Output all the floating-point numbers with maximal precision possible. Your solution will be considered correct if verifying your schedule doesn't lead to discrepancies of more than 10-6 (in checking the total distance traveled, in checking that lane changes are non-overlapping, etc), so it's better for you to output at least 10 - 12 digits after the decimal point in each floating-point number.

Time limit 1 second
Memory limit 128 MiB
Input example #1
1 100 0.5
4 5 0
Output example #1
19.71726232777025
0
Input example #2
3 100 0.5
4 5 0
2 5 0.5
0 5 0
Output example #2
19.052103083697858
4
2 3.6645304897691258
1 5.783185307179586
2 9.947715796948712
3 15.207963267948966
Source 2007 Петрозаводск, Petr Mitrichev Contest 2, Январь 30, Задача F