#Lutece0556. Building Roads

Building Roads

Migrated from Lutece 556 Building Roads

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

After the war between Country XX and Country YY, all the roads in Country XX have been destroyed. Qiqi, the king of Country XX wants to build some roads to connect all cities (it means that starting from every city, we can go to any other cities through roads Qiqi built) as soon as possible.

Every road takes one day to build and every day Qiqi can build only one road. Building the road between city ii and city jj costs pipj|p_i - p_j| units money, where pip_i and pjp_j are the population of city ii and city jj. What is the maximum and minimum cost if Qiqi wants to connect all cities in the shortest time?

Input

There are multiple test cases. The first line of the input will be an integer TT (T50T \leq 50) indicating the number of test cases.

For each test case there is an integer NN (1N10001 \leq N \leq 1000) in a single line, representing the number of cities in Country XX. The next line lists NN integers describing the population of each city.

All cities' population are between 11 and 1000010000(inclusive).

Output

For each test case, print Case #t: first, in which tt is the number of the test case starting from 11. Then output the minimum and maximum cost.

Samples

1
3
1 2 3
Case #1: 2 3

Note

Huge input/output. Please use scanf/printf for C/C++.

For the first sample, we can build the roads between 11 and 22, 22 and 33 to get the minimum cost of 22. And build the roads between 11 and 22, 11 and 33 to get the maximum cost of 33.

Resources

10th UESTC Programming Contest Preliminary