The Luncheon

Karim and Rahim go to the same restaurant once every day to have lunch. They both have their own list of favorite dishes but they dont necessarily eat their favorite dishes at lunch. The restaurant they visit have N dishes in total. Karim and Rahim choose a dish randomly (They both eat the same dish) from the N dishes and have it for lunch. They go to that restaurant regularly for D days. You have to find the probability that the number of days for which the dish chosen is a favorite of Rahim’s is exactly twice the number of days for which the dish chosen is a favorite of Karim’s. Input The input file contains at most 600 sets of inputs. The description of each set is given below: Each set starts with an integer N (0 < N < 37) which denotes the total number of dishes. Dishes are identified by integers from 1..N. Next line starts with an integer S (0 ≤ S < N) which denotes the total number of Karims favorite dishes. Next S distinct integers are favorite dishes of Karim. All these integers are within the range (1..N). The Next line starts with an integer T (0 ≤ T < N) which denotes the total number of Rahims favorite dishes. Next T distinct integers are favorite dishes of Rahim. All these integers are also within the range (1..N). The next line contains an integer D (0 < D < 101) which indicates how many days Karim and Rahim goes to the restaurant. Input is terminated by a line containing a single zero. Output For each set of input produce one line of output. This line contains the serial of output followed by the desired probability rounded to five digits after the decimal point. Look at the output for sample input for details. There is no special judge for this problem. But the judge data is such that errors less than 2 ∗ 10−7 will be ignored. But please make sure when the answer very near to zero you print it as ‘0.00000’ and not as ‘-0.00000’. Sample Input 6 3123 3456 18 7 3123 3456 20 8 3123 3234 20 0 Sample Output Case 1: 0.07082

2/2 Case 2: 0.02592 Case 3: 0.01501