After being all out for 58 and 78 in two matches in the most prestigious tournament in the world, the coach of a certain national cricket team was very upset. He decided to make the batsmen practice a lot. But he was wondering how to make them practice, because the possibility of getting out seems completely random for them. So, he decided to keep them in practice as long as he can and told them to practice in the net until a batsman remains not-out for k1 consecutive balls. But if the batsman continues to be out for consecutive k2 balls, then the coach becomes hopeless about the batsman and throws him out ofthe team. In both cases, the practice session ends for the batsman. Now the coach is wondering how many balls the practice session is expected to take.
For a batsman the probability of being out in a ball is independent and is equal to p. What is the expected number of balls he must face to remain not out for k1 consecutive balls or become out in consecutive k2 balls.
Input
Input starts with an integer T (≤ 15000),denoting the number of test cases.
Each case starts with a line containing a real number p (0≤ p ≤ 1) and two positive integers k1 and k2(k1 + k2 ≤ 50). p will contain up to three digits after the decimal point.
Output
For each case, print the case number and the expected numberof balls the batsman will face. Errors less than 10-2 will be ignored.
Sample
Sample Input | Sample Output |
---|---|
5 0.5 1 1 0.5 1 2 0.5 2 2 0.19 1 3 0.33 2 1 | Case 1: 1 Case 2: 1.5 Case 3: 3 Case 4: 1.2261000000 Case 5: 1.67 |