A computer is built from several components. If any one of them fails, the whole computer stops. The semester budget arrives in one lump at the start of the semester, so you can spend it on spare components and swap a spare in the moment something breaks.
Failures follow a Poisson distribution. The probability that component i fails exactly k times during t time units is
Pi(k,t)=k!e−λit(λit)k
Only one semester is considered here, so t is fixed at 1 and the formula reduces to
Pi(k)=k!e−λiλik
λi is the expected number of times component i fails in one semester. Failures of different components are independent.
If you buy si spares of component i, the computer keeps running as long as component i fails at most si times during the semester. One spare of component i costs ri, and the total money spent on spares cannot exceed the budget b. The probability that the computer survives the whole semester is the product of the per component probabilities.
Decide how many spares of each component to buy within the budget so that this probability is as large as possible.
The first line contains the number of test cases n (1≤n≤50).
Each test case consists of three lines. The first line contains the number of components that may fail, c (1≤c≤500), and the budget b (0≤b≤500), separated by a single space. The second line contains c floating point numbers. The ith number is λi (0.0≤λi≤5.0), the expected number of times component i fails in one semester. The third line contains c integers. The ith number is ri (1≤ri≤100), the price of one spare of component i.
For each test case, print the maximum survival probability you can reach on a line of its own, rounded to 5 decimal places.