Problem hidden

CODEM2 - Problem2

Two boxes contain the same total numbers of balls having some blacks and some whites in each. From each box "n" number of balls are drawn with replacement. Find the number of white balls in box A if composition of box B is given and such that probability that all white balls are drawn from box A is equal to the probability that the drawing from box B is either all whites or all blacks for the given number of drawings.

Input

T: number of test cases
Next T lines contain 3 integers n, x, y.

Output

For each test case print in new line "impossible" if it is not possible to find number of white balls in box A else print number of white balls.

Constraints

1 <= n <= 1000
1 <= x, y <= 1000
x = number of white balls in box B, y = number of black balls in box B

Example

Input:
1
2 3 4 Output: 5

Adicionado por:Bhavik
Data:2014-02-04
Tempo limite:0.5s
Tamanho do fonte:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Linguagem permitida:Todas exceto: ASM64 CLOJURE ERL FSHARP PERL6 PY_NBC SCALA TCL
Origem:own problem(for CODE MARATHON)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.