Combat Odds

No attempts yetTime limit1sMemory limit256 MB

Problem

On game forums there is always someone who blames the game for his own losses. A lack of realism or a cheating AI are the usual charges. Most of the time the real problem is skill.

The latest complaint comes from a player who says the computer cheats in the game he just bought. A battle is reported as a 70% chance to win and he loses it anyway. Another player takes his side and adds that he has lost five such battles in a row. The probability of that is (10.7)5=0.00243(1 - 0.7)^5 = 0.00243, so the game cannot be honest, he says. That number is right only if those five battles are the only ones that ever happen. A single game contains far more battles than five, so the chance that such a streak shows up somewhere is much larger. You decide to compute it yourself.

A battle ends in a win or a loss, and the probability of a win is pp. Given NN battles, find the probability that a losing streak of length at least LL appears at least once. Battle outcomes are independent of each other and the random number generator is fair.

Input

The first line contains the number of test cases TT. Each of the next TT lines contains NN, LL and pp for one test case, separated by whitespace.

  • 0<T2000 < T \le 200
  • 0<N20000 < N \le 2000
  • 0<LN0 < L \le N
  • 0p1.00 \le p \le 1.0

Output

For each test case, print on its own line the probability that a losing streak of length at least LL appears. Round the value to exactly nine digits after the decimal point and pad with zeros when digits are missing.