spoj#STICKS. Magic Sticks

Magic Sticks

We have N sticks are lined up in a queue with different distances between them , and each stick is leaning on the left stick (look at figure) .

L : the length of the stick.

D : the distance between the stick head point and the left one head point.

We catch the first stick (that length L0) and keep it vertical.

determine the total time that expected to fall down all sticks if the first stick moved away (assume that each stick's bottom head will not displaced , and when the stick reach ground it will vanish and the right one start to fall ).

you will have V (linear velocity for the head point) at time = 1 second (from the stick start to fall , if we assume that stick will not stop and keeping same motion type).

suppose that wight force has stable effect on the stick in dirction and value

 

Input

the first line : N , L0

next N-1 Line : Lk , Dk , Vk(1)

Output

One number T (total time in millisecond).

Example

Input:
2 8.75
10 8.7 25000

Output: 2



2 <= N <= 5000
1 <= L <= 1000000
1 <= V <= 1000000

.

</p>