Hide

Problem I
Iguana Intervals

\includegraphics[width=0.45\textwidth ]{iguana.jpg}

The time has finally come! The annual Iguana marathon is here, and as always, you are supplying the odds for the big Iguana betting market. To provide the most accurate odds it is crucial to have intricate knowledge of the racing profile of each iguana, and a deep understanding of the iguana racing strategy.

The iguanas are terrible marathoners. They all start sprinting for as long as they can, forcing them to rest and recover until they can sprint again. This alternating pattern will repeat throughout the race, and the Iguanas will always rest until they are ready for a full sprint before proceeding to sprint again.

Input

The first line of input contains two integers $N$ and $D$, the number of iguanas and the distance in meters of the race. Then $N$ lines follow, each describing an iguana. Each of these lines contains three integers $t_{sprint}$, $t_{rest}$ and $v_{sprint}$, the time in seconds the iguana can sprint, the time it takes for the iguana to fully rest, and the sprinting speed of the iguana in meters per second while sprinting, respectively.

Output

For each iguana, output a single line containing the time in seconds at which the iguana will complete the race. The race is completed when the iguana reaches the finish line. The answer must be accurate to within an absolute or relative error of $10^{-5}$.

Limits

  • $1 \leq N \leq 42195$

  • $1 \leq D \leq 100$

  • $1 \leq t_{sprint}, t_{rest}, v_{sprint} \leq 20$

Sample Input 1 Sample Output 1
3 100
5 10 8
11 20 10
3 2 15
32.5
10.0
10.666666666666666

Please log in to submit a solution to this problem

Log in