Fitting Pipes Again

We are making a box to pack some regular octagonal pipes. The box is 8 feet wide, and the length of each pipe is also 8 feet. But they have different cross sectional heights. A regular octagonal pipe has equal cross sectional height and width. If you are unfamiliar with octagonal pipes, see pictures below. These pipes will be placed in the box such that, their lengths align with the width of the box and one of the eight sides must touch the box’s floor completely, which means, we cannot stack them one above the other. The next picture will show you a particular packing example, where three pipes have been packed in the box. Output If you are given the cross sectional heights of pipes we wish to pack in the box, can you calculate the min- imum possible volume for the box? You can change the order of pipes but you have to follow the rules for placing them in the box. You can assume, the number of pipes will be at most 8, height of each pipe is no greater than 100,000 feet and there can be at most 100 test cases. Input First line of the input will be an integer T (1 ≤ T ≤ 100) which indicates the number of test cases to follow. For each test case, you will read an in- teger N (1 ≤ N ≤ 8) followed by N integers Hi (1 ≤ Hi ≤ 100000) where N is the number of pipes and Hi is the cross sectional height of i-th pipe. For each test case, print the case number and the desired volume of the box as shown in the sample output section. Any floating point errors less than 10−6 will be ignored by the judge. Note: It is up to you how many digits you want to print after decimal point. Just make sure that the amount of error does not exceed the specified limit.

2/2 Sample Input 3 3555 1 25 610 2 2 9 4 6 Sample Output Case 1: 600 Case 2: 5000 Case 3: 2331.370849898476