Cookie Farm

No attempts yetTime limit10sMemory limit64 MB

Problem

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 CC cookies you can buy one cookie farm. Each farm costs CC cookies and permanently adds FF cookies per second to your production.

You win the moment you hold XX 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.10.1 seconds after the game starts you have 0.20.2 cookies, and π\pi seconds after it starts you have 2π2\pi cookies.

For C=500.0C = 500.0, F=4.0F = 4.0 and X=2000.0X = 2000.0 the best strategy plays out like this.

  1. You start with 0 cookies and a production of 2 cookies per second.
  2. After 250250 seconds you hold C=500C = 500 cookies, so you buy a farm that adds F=4F = 4 cookies per second.
  3. After the purchase you hold 0 cookies and your total production is 6 cookies per second.
  4. The next farm also costs 500 cookies, which you can afford about 83.333333383.3333333 seconds later.
  5. After the second purchase you hold 0 cookies and your total production is 10 cookies per second.
  6. The farm after that also costs 500 cookies, which you can afford 5050 seconds later.
  7. After the third purchase you hold 0 cookies and your total production is 14 cookies per second.
  8. A fourth farm would also cost 500 cookies, but skipping it is better. Waiting instead until you hold X=2000X = 2000 cookies takes about 142.8571429142.8571429 seconds.

The total is 250+83.3333333+50+142.8571429=526.1904762250 + 83.3333333 + 50 + 142.8571429 = 526.1904762 seconds.

Input

The first line contains the number of test cases TT (1T1001 \le T \le 100).

Each of the next TT lines contains three space-separated real numbers CC, FF and XX, with the meanings given above.

1.0C500.01.0 \le C \le 500.0, 1.0F4.01.0 \le F \le 4.0, 1.0X2000.01.0 \le X \le 2000.0.

Each of CC, FF and XX is written as one or more digits, then a single decimal point, then 1 to 5 digits. No value has a leading zero.

Output

For each test case print one line of the form Case #x: y, where xx is the test case number starting from 1 and yy is the minimum number of seconds before you hold XX cookies.

Round yy to four decimal places and print exactly four digits after the decimal point.