|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||256 MB||12||4||1||11.111%|
It's said that the shortest period of time is the measurement between when the traffic light turns green and the New York cab driver behind you blows his horn. Not so for Yraglac -- he's a little more reasonable and only does so when the cars ahead of him exceed a reasonable time bound before they start moving.
However, Yraglac's horn is only capable of blowing three times before he has to replace it (he's a little cheap and refuses to upgrade to the four-use horn), so he's trying to be more patient with his fellow drivers. One technique that he tries to distract himself with is estimating the probability that he'll be able to begin moving within T seconds of the light turning green.
Unfortunately, Yraglac has no way of verifying if his answers are correct, so the exercise seems pointless. Yraglac would like you to write a program that calculates the probability that he can begin moving within T seconds, given information about when the vehicles in front of him are likely to start moving.
You may assume that the counter for when a vehicle begins moving begins immediately after the vehicle in front of it begins moving (or when the light turns green, whichever is applicable).
Each input file contains multiple test cases. Each test case begins with a number 0 < N < 1000, the number of vehicles in front of Yraglac. There follow N lines of the form k p1 p2 ... pk, where 0 <k < 10, and 0 ≤ pi ≤ 1 is the probability that the vehicle begins i seconds after the vehicle before it begins moving; note that the pi sum to one. After this is a single line containing the integer T.
The input ends with a number zero.
For each test case, output the probability that Yraglac can move within T seconds, truncated to two decimal places.
1 1 1 1 1 2 .5 .5 1 2 2 .5 .5 2 .25 .75 2 0
1.00 0.50 0.12