BYU15W_4 - Game Calculator

A game is played where two armies face each other. Each turn, every unit in both armies either scores a hit or a miss. Each army then removes a number of units equal to the number of hits scored by the opposing army. The game is over when at the end of a turn, one army does not have any more units. If both armies run out of units on the same turn, the game is a draw. The probability of any one unit scoring a hit is determined at the beginning of the game and remains constant.

The goal is to determine the probability of army A winning, army B winning, or the game ending in a draw.

Example

If the probability of scoring a hit is 0.3, army A has 2 units, and army B has 1 unit, then A has a 0.86839 chance of winning, B has a 0.09213 chance of winning and there is a 0.03948 chance of a draw.

Input

The first line contains a single positive integer T, representing the number of test cases. T test cases follow. Each test case is two lines long. The first line of each test case contains a single decimal number H. The second line contains two positive integers A and B, representing the number of units in each army.

Limits

0 < H <= 1

0 < A, B <= 1,000,000

Output

For each test case, output a single line containing three decimal numbers representing the chance of A winning, B winning and ending in a draw, respectively. Each number should rounded to exactly 5 decimal places.

Example

Input:
2
0.3
2 1
0.854
8 8

Output:
0.86839 0.09213 0.03948
0.38532 0.38532 0.22936

Added by:BYU Admin
Date:2015-03-28
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2017-07-14 16:56:52
Min_25
You don't understand the problem
2016-06-11 21:24:41 Min_25
When H = 0.976 and A = B = 1, the probability of a draw is exactly 0.953125, and it can be rounded to 0.95312 or 0.95313.

Please write the details of the judge when the output contains floating-point numbers.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.