#P17095. [ICPC 2017 Qingdao R] Enclosure of Land and Water

[ICPC 2017 Qingdao R] Enclosure of Land and Water

Problem Description

Mouton, the king of Tyre, had a clever beautiful princess named Dido. Dido lived a happy and free life in her kingdom, but good times didn’t last long, her husband was killed by her brother, the king of Cyprus. Dido then fled to the west coast of Africa and wanted to live there. So she carried out her jewelry, jade and gold to buy some land and water from the local chief Jarbas. Jarbas said, “Now you can go anywhere you want. The land and water that is enclosed by the curve you have moved is what you will get. You need to finish the enclosure before the sun set.”

The coast is a straight line and the distance between the starting point and the coast is dd units of distance. As shown below.

:::align{center} :::

The moving speed on the land (resp. water) is vv (resp. ww) units of distance per unit of time, and the land (resp. water) is worth VV (resp. WW) units of value per unit of area. The remaining time before the sun set is tt units of time. Dido must return to the starting point before the sun set. She will get the land and water that is enclosed by the curve she has moved. She wants to maximize the sum of the value of the land and water she encloses.

Your task is to find out the best moving curve and calculate the maximum sum of value that Dido can get.

Input Format

The first line is the number of test cases up to 100. For each test case, there are 6 real numbers dd, vv, ww, VV, WW and tt, which are all between 0.1 and 10.

Output Format

For each test case, output the maximum sum of value that Dido can get with the precision of 3 digits after the decimal point.

4
0.5 0.1 10 0.1 10 10
1 1 2 1 2 3
2 1 10 10 0.1 6
1 9 8 5 7 6
0.008
1.330
50.554
1326.027