Horn Blowing

No attempts yetTime limit2sMemory limit256 MB

Problem

People say the shortest measurable stretch of time is the gap between the light turning green and the driver behind you leaning on the horn. Yraglac is more patient than that. He honks only when the cars ahead of him take longer than a reasonable time to start moving.

His horn has three uses left before it wears out, and he refuses to buy a new one, so he waits and occupies himself with something else. He estimates the probability that he can start moving within TT seconds of the light turning green.

There are NN vehicles in front of Yraglac. Each vehicle starts moving a whole number of seconds after the vehicle directly in front of it starts moving, and that number follows the distribution given for the vehicle. The vehicle at the head of the line counts from the moment the light turns green. Yraglac starts moving at the moment the vehicle directly in front of him starts moving.

Given the distribution of every vehicle ahead of him, compute the probability that Yraglac starts moving within TT seconds of the light turning green.

Input

The input contains several test cases.

The first line of each test case has the number of vehicles in front of Yraglac, NN (0<N<10000 < N < 1000).

The next NN lines describe one vehicle each in the form k p1 p2  pkk\ p_1\ p_2\ \dots\ p_k (0<k<100 < k < 10). Here pip_i is the probability that this vehicle starts moving ii seconds after the vehicle in front of it starts moving, with 0pi10 \le p_i \le 1 and p1+p2++pk=1p_1 + p_2 + \dots + p_k = 1. A probability may be written without its integer part, as in .5.

The line after that has the integer TT (0T100000 \le T \le 10000).

The input ends with a line containing a single 0. The sum of NN over all test cases is at most 3000.

Output

For each test case, print on one line the probability that Yraglac starts moving within TT seconds of the light turning green, truncated to two decimal places.

Truncate, do not round: 0.519 prints as 0.51. A value that is exactly 0.51 must still print as 0.51, so watch out for floating point error.