{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eConsider a device, which performs some work. Besides it must control its temperature. It must be neither too high nor too low. But something wrong has happened with the temperature controlling mechanisms, and now the device acts as follows. In each minute it selects one of possible actions of changing its temperatures and executes it. Each action is selected with the given probability, based on current temperature.\u003c/p\u003e\n\n\u003cp\u003eThe probabilities of temperature changes are given to you. Сount the probability of the event, that the temperature stays in the given range for a certain time.\u003c/p\u003e\n\n\u003cp\u003e\u003ch2\u003eInput\u003c/h2\u003e\u003c/p\u003e\n\n\u003cp\u003eFirst line of input contains the quantity of tests \u003cstrong\u003eT\u003c/strong\u003e (\u003cstrong\u003e1\u003c/strong\u003e ≤ \u003cstrong\u003eT\u003c/strong\u003e ≤ \u003cstrong\u003e20\u003c/strong\u003e). First line for each test contains numbers \u003cstrong\u003eA\u003c/strong\u003e, \u003cstrong\u003eB\u003c/strong\u003e, \u003cstrong\u003eC\u003c/strong\u003e, \u003cstrong\u003eN\u003c/strong\u003e, where \u003cstrong\u003eA\u003c/strong\u003e is the minimal allowed temperature, \u003cstrong\u003eB\u003c/strong\u003e is the maximal allowed temperature, \u003cstrong\u003eC\u003c/strong\u003e is the starting temperature, \u003cstrong\u003eN\u003c/strong\u003e is the device\u0027s working time in minutes. \u003cstrong\u003e0\u003c/strong\u003e ≤ \u003cstrong\u003eA\u003c/strong\u003e ≤ \u003cstrong\u003eB\u003c/strong\u003e ≤ \u003cstrong\u003e30\u003c/strong\u003e, \u003cstrong\u003eA\u003c/strong\u003e ≤ \u003cstrong\u003eC\u003c/strong\u003e ≤ \u003cstrong\u003eB\u003c/strong\u003e, \u003cstrong\u003e0\u003c/strong\u003e ≤ \u003cstrong\u003eN\u003c/strong\u003e ≤ \u003cstrong\u003e30\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003eEach of the next \u003cstrong\u003eB\u003c/strong\u003e--\u003cstrong\u003eA\u003c/strong\u003e+\u003cstrong\u003e1\u003c/strong\u003e lines contains \u003cstrong\u003e7\u003c/strong\u003e nonnegative integers, that sum up to \u003cstrong\u003e100\u003c/strong\u003e -- percentages of changes by \u003cstrong\u003e--4\u003c/strong\u003e, \u003cstrong\u003e--3\u003c/strong\u003e, \u003cstrong\u003e--2\u003c/strong\u003e, \u003cstrong\u003e--1\u003c/strong\u003e, \u003cstrong\u003e0\u003c/strong\u003e, \u003cstrong\u003e1\u003c/strong\u003e and \u003cstrong\u003e2\u003c/strong\u003e degrees correspondingly. \u003cstrong\u003eK\u003c/strong\u003e-th line (\u003cstrong\u003e1\u003c/strong\u003e ≤ \u003cstrong\u003eK\u003c/strong\u003e ≤ \u003cstrong\u003eB\u003c/strong\u003e--\u003cstrong\u003eA\u003c/strong\u003e+\u003cstrong\u003e1\u003c/strong\u003e) describes the probabilities for situation, when current temperature is equal to \u003cstrong\u003eA\u003c/strong\u003e+\u003cstrong\u003eK\u003c/strong\u003e--\u003cstrong\u003e1\u003c/strong\u003e.\u003c/p\u003e\n\n\u003cp\u003e\u003ch2\u003eOutput\u003c/h2\u003e\u003c/p\u003e\n\n\u003cp\u003eOutput \u003cstrong\u003eT\u003c/strong\u003e lines of the form \"\u003cstrong\u003eCase\u003c/strong\u003e #\u003cstrong\u003eA\u003c/strong\u003e: \u003cstrong\u003eB\u003c/strong\u003e\", where \u003cstrong\u003eA\u003c/strong\u003e is the number of test (beginning from \u003cstrong\u003e1\u003c/strong\u003e), \u003cstrong\u003eB\u003c/strong\u003e is the desired probability for this test case. You must output the answer without rounding. It is guaranteed, that the answer has at most 60 decimal digits after the point.\u003c/p\u003e\n\n"}},{"title":"Example","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n1 2 1 2\n0 0 0 10 50 40 0\n0 0 50 0 0 30 20\n3 5 4 5\n0 0 0 10 20 30 40\n0 0 10 20 30 40 0\n0 10 20 30 40 0 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 0.45\nCase #2: 0.59049\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}