Gift Box

You want to give a special gift to your special friend on a special occasion in a very special box! So you have bought some special ribbons and you want to wrap the gift box in a special way. Instead of wrapping it in a traditional way, that is ribbons crossing through the middle of the box parallel to the edges, you are wrapping it in a way that the ribbon makes a complete loop around the box creating two parallel pieces of ribbons on the top and on the bottom of the box (see picture below). The ribbon crosses every face once, except the top and bottom, which it crosses twice. The ribbon rests tightly against the box all the way round because the angle at which it meets an edge is continued onto the next face. In the above picture, the ribbon is running through I-J-K-L-M-N-O-P points. JK and ON are the parallel pieces on the top while IP and LM are the parallel pieces on the bottom. If you are given the length, width and height of the box, can you find the length of the ribbon? Input Input starts with an integer T (1 ≤ T ≤ 1000), the number of test cases. Each test case consists of three integers, L, W and H, denoting the length, width and height of the box respectively. You can assume that 1 ≤ L, W, H ≤ 1000. Lengths are given in centimeters. Output For each test case, first print the case number starting from 1 as shown in sample input and output section, then print the length of the ribbon in centimeters rounded off to 4 decimal places. Floating point error lower than 10−3 will be ignored by the judge. Check sample input and output for details. Sample Input 2

2/2 60 30 15 20 10 5 Sample Output Case 1: 174.9286 Case 2: 58.3095