Poker End Games

Alice and Bob loves playing poker with their friends. Unfortunately, they play poker way better than their friends. So, almost always they are the last two players to play. Two of them can play for a long time and it bores their friends. So they changed the rule little bit and decided that both of them will go all in every round. Now, Alice is wondering what is the expected length of the game, and what is the probability that she will win the game. Let’s say at the beginning of round i, Alice has ai Taka (Currency of Bangladesh) and Bob has bi Taka. and ci is the minimum of ai and bi. Alice and Bob are equally likely to win the round. If Alice wins, she gets ci Taka from Bob, otherwise Bob gets ci Taka from her. Game ends when one of them has 0 (Zero) Taka and obviously the person with 0 taka loses. Given that the initial amount Alice has is a0 and the initial amount that Bob has is b0, you have to find the probability that Alice is going to win and expected number of rounds the game is played. Input Input file starts with a number T (0 < T ≤ 100). T test cases follow. The input for each test case is contained in a single line and it consists two integers a and b (0 < a, b ≤ 150). Output For each case, print the case number followed by the expected number of rounds and the probability that Alice will win. Print both result rounded to 6 digits after the decimal point. For both these values errors less than 10−5 will be ignored. Sample Input 2 11 21 Sample Output Case 1: 1.000000 0.500000 Case 2: 2.000000 0.666667