Random Walk

Time limit10sMemory limit128 MB

Problem

A random walk works like this: before each step you toss a coin, then move one cell to the left on heads and one cell to the right on tails. The expected position of such a walk is always $0$ -- no matter how many steps you take, the average position equals the starting point.

The coin in this problem is unusual: heads and tails need not be equally likely, and the coin can also land on its edge. Given the probability of going left, the probability of going right, and the number of tosses, write a program that computes the expected value of the rightmost position reached during the walk.

The walk starts at position $0$, which is included when taking the rightmost (maximum) position, so the answer is never negative.

Input

The first line contains $P$, the number of test cases. The test cases are independent.

Each test case is a single line with three numbers, in order: $n$, $L$, $R$. Here $n$ ($1 \le n \le 1000$) is the number of coin tosses, and $L$ and $R$ are the probabilities of moving left and right respectively ($0 \le L \le 1$, $0 \le R \le 1$, $0 \le L + R \le 1$). The remaining probability $1 - L - R$ is the chance the coin lands on its edge, in which case the walker stays in place.

Output

For each test case, print the expected value of the rightmost position, rounded to four decimal places.