Stan likes to play Crown & Anchor, a gambling game in which one bets on one of six symbols: Crown, Anchor, Club, Diamond, Heart, or Spade.
A wheel is spun and stops in a position marked by three symbols (not necessarily distinct). If the symbol Stan bet on appears $n$ times among the three, he receives his bet back plus $n$ times his bet — that is, his net gain is $n$ times his bet. If his symbol does not appear at all, he loses his bet.
Stan has made a side bet with Ollie: that he can make money playing Crown & Anchor. Ollie realizes Stan might get lucky and win the first few rounds, so he insists that, to win the bet, Stan must be ahead after at least $k$ rounds. Also, so the matter is settled quickly, Stan must show a profit within at most $m$ rounds.
Stan's plan is the Monte Carlo (martingale) betting strategy. He first places the minimum bet. If he wins, he pockets the profit and again places the minimum bet. If he loses, he doubles his bet, so that winning the next round recoups his previous losses and still yields a profit. This doubling continues until he wins; whenever he wins, he pockets the profit and starts over at the minimum bet.
The house counters with a house limit $l$: the maximum bet allowed in any single round. Stan therefore adjusts his strategy: if doubling his bet would exceed the house limit, he starts over at the minimum bet instead, hoping to recover the loss later.
The minimum bet is $1$. Following this strategy, Stan wins the side bet if his net winnings are strictly positive at any checkpoint from after round $k$ through after round $m$. Find the probability that Stan wins the side bet.
The first line contains $n$, the number of test cases. Each test case is a single line with three integers $k$, $m$, and $l$: the minimum number of rounds after which Stan must be ahead, the maximum number of rounds, and the house limit.
For each test case, print the probability that Stan wins the side bet, rounded to $4$ decimal places, on its own line.
The wheel has $28$ stopping positions. There are $14$ distinct symbol combinations, and each appears twice on the wheel. The $14$ combinations consist of:
The layout is symmetric, so every symbol has the same distribution of appearance counts. For any chosen symbol, counting the stopping positions gives:
Hence, in a single round, the number of times the chosen symbol appears has probabilities
$$P(0) = \frac{20}{28},\quad P(1) = \frac{4}{28},\quad P(2) = \frac{2}{28},\quad P(3) = \frac{2}{28}$$