Fireworks
题号:NC216006
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

Kotori is practicing making fireworks for the upcoming hanabi taikai1. It takes her n minutes to make a single firework, and as she is not really proficient in making fireworks, each firework only has a probability of to be perfect.

After she finishes making a firework, she can just start making the next firework, or take m minutes to light all the remaining fireworks finished before. If there is at least one perfect firework among the lit ones, she will be happy and go to rest. Otherwise, she will continue practicing. Can you tell her the minimum expected practicing time before she goes to rest if she takes the optimal strategy?

Notice that no matter how many fireworks remain, it always takes m minutes to light them all.
                                    
1Hanabi taikai: Romaji of the Japanese word "花火大會", which means the firework... err... party?

输入描述:

There are multiple test cases. The first line of the input contains an integer T () indicating the number of test cases. For each test case:

The first and only line contains three integers n, m and p (, ).

输出描述:

For each test case, output one line containing one number indicating the minimum expected practicing time.

Your answer will be considered correct if and only if the absolute or relative error does not exceed .
示例1

输入

复制
3
1 1 5000
1 1 1
1 2 10000

输出

复制
4.0000000000
10141.5852891136
3.0000000000