The Packaging Box

faiyaz26 Intra NSU Programming Con...
Limits 1s, 512 MB

VHL is an international mail service company. Customers can send various packages to different places of the world via them.

VHL is planning to make a standard package box to contain the client's documents and stuff.

And they want to use different paper in different side of the box. And each paper costs different or maybe same.

The paper costs PP, QQ and RR per square meter for the bottom, sides and the top respectively.

The box have to have a total volume of Vm3V m^3. Check the figure below:

The company wants to have the dimensions in a way such that the total cost of construction is as low as possible.

Now you need to write a program that will take PP, QQ, RR and VV as input and output the minimum cost of building the box.


Input starts with a positive integer TT (500≤ 500), denoting the number of test cases.

Each case starts with a line containing four real numbers denoting PP, QQ, RR, VV.

Each value is at least 1.0 and at most 10410^4 and contains at most five places after the decimal point.

And PP, QQ, RR will be distinct.


For each line of input produce a line of output. Each line will contain one real number denoting the minimum cost to build the box. Errors less than 10610^{-6} will be ignored.


1 2 5 96

For the height=6\text{height}=6, depth=4\text{depth} = 4, length = 4\text{length = 4}, we get the minimum cost of 288.


Login to submit.


78% Solution Ratio
himuhasibEarliest, Feb '16
StarscreamFastest, 0.0s
nfssdqLightest, 131 kB
SabbirsShortest, 141B
Toph uses cookies. By continuing you agree to our Cookie Policy.