ARAM (Small)

Decide when to spend a capped, regenerating reroll budget on fresh random champions to maximize the long-run share of games won.

Medium7Dynamic programmingProbabilityGreedyNo attempts yetTime limit5sMemory limit512 MB

Problem

League of Legends has a mode called "ARAM", short for "All Random, All Mid". This problem borrows the idea, and you do not need to have played the game to follow it.

Every time you start a game you are assigned one of NN champions uniformly at random. You win more often with some champions than with others, so an unlucky assignment leaves you wishing for a different one. The game has a reroll function for exactly that.

Rerolling works like a kind of money. Before your first game you start with RR RD (reroll dollars). You can reroll only while you hold at least 1 RD, and each reroll costs 1 RD. After every game you gain 1/G1/G RD, where GG is an integer, but your balance never rises above RR: if you hold RR RD and play a game, you still hold RR RD when that game ends.

If you hold at least 1 RD and choose to reroll, you spend 1 RD and are assigned one of the NN champions uniformly at random again. The champion you already had can come up again. If you dislike the new champion and still hold at least 1 RD, you reroll again. You can keep rerolling as long as you hold at least 1 RD.

For example, take R=2R = 2 and G=2G = 2. If you use one reroll in your first game, your balance is 1.5 RD when that game ends. Play another game without rerolling and the balance becomes 2.0 RD. Play a third game without rerolling and the balance is still 2.0 RD, because it never rises above R=2R = 2. Use two rerolls in the next game and the balance is 0.5 RD when that game ends.

You are given the list of champions and the probability that you win a game played with each of them. If you play 1010010^{100} games and choose your strategy optimally, what fraction of the games do you expect to win?

Input

The first line contains the number of test cases TT. Each test case starts with a line holding three space separated integers NN, RR and GG. The next line holds NN space separated real numbers P1,P2,,PNP_1, P_2, \ldots, P_N, where PiP_i is the probability that you win a game played with champion ii.

1T1001 \le T \le 100, 1N10001 \le N \le 1000, 1R41 \le R \le 4, 1G41 \le G \le 4. Every PiP_i is written with exactly four digits after the decimal point and satisfies 0Pi10 \le P_i \le 1.

Output

For each test case print one line of the form "Case #x: y", where xx is the test case number starting from 1 and yy is the fraction of the 1010010^{100} games you win under an optimal strategy. Round yy to nine digits after the decimal point and print all nine of them.

Note

League of Legends is a trademark of Riot Games. Riot Games has no involvement with this problem.