What is the probability?#1571

What is the probability?

1 second
128 megabytes
Medium

Probability is often an integral part of computer algorithms. When deterministic algorithms are unable to solve a problem within a reasonable amount of time, probabilistic algorithms come to the rescue. However, in this problem you are not required to design a probabilistic algorithm — you only need to compute the probability that a particular player wins the game.

The game involves players who take turns throwing an object similar to a die (the number of faces is not necessarily six). The players move in order: first the first player, then the second, and so on up to the -th player. If in a given round none of the players wins, the game continues again starting from the first player.

A player wins if, during their turn, a certain event occurs (for example, the number is rolled, a green face appears, and so on), after which the game ends immediately. The probability that this winning event occurs in a single throw is .

Determine the probability that the player with number wins.

Input

The first line contains a single integer t~(t \le 1000) — the number of test cases. Each of the following lines contains three values: the number of players n~(n \le 1000), a real number p~(0 \le p \le 1) — the probability of the winning event in a single throw, and the player number i~(1 \le i \le n) for which the winning probability should be computed.

Output

For each test case, print the probability that the -th player wins. The answer should be printed with exactly digits after the decimal point.

Examples

Example 1

Loading
Loading