Cookie Farm is a clicker game. Players click a picture of a giant cookie to earn cookies, then spend those cookies on buildings that make cookies arrive faster.
In this problem you start with 0 cookies and earn 2 cookies per second by clicking the giant cookie. Whenever you hold at least C cookies you can buy one cookie farm. Each farm costs C cookies and permanently adds F cookies per second to your production.
You win the moment you hold X cookies that you have not spent on farms. Write a program that finds how long winning takes under the best possible strategy.
Cookies arrive continuously. 0.1 seconds after the game starts you have 0.2 cookies, and π seconds after it starts you have 2π cookies.
For C=500.0, F=4.0 and X=2000.0 the best strategy plays out like this.
The total is 250+83.3333333+50+142.8571429=526.1904762 seconds.
The first line contains the number of test cases T (1≤T≤100).
Each of the next T lines contains three space-separated real numbers C, F and X, with the meanings given above.
1.0≤C≤500.0, 1.0≤F≤4.0, 1.0≤X≤2000.0.
Each of C, F and X is written as one or more digits, then a single decimal point, then 1 to 5 digits. No value has a leading zero.
For each test case print one line of the form Case #x: y, where x is the test case number starting from 1 and y is the minimum number of seconds before you hold X cookies.
Round y to four decimal places and print exactly four digits after the decimal point.