CRUCE  Crossing the bridge
n people wish to cross a bridge at night. A group of at most two people may cross at any time, and each group must have a flashlight. Only one flashlight is available among the n people, so some sort of shuttle arrangement must be arranged in order to return the flashlight so that more people may cross.
Each person has a different crossing speed; the speed of a group is determined by the speed of the slower member. Your job is to determine a strategy that gets all n people across the bridge in the minimum time.
Input
The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs.
The line of input contains n, followed by n lines giving the crossing times for each of the people. There are not more than 1000 people and nobody takes more than 100 seconds to cross the bridge.
Output
For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line.
The line of output must contain the total number of seconds required for all n people to cross the bridge.
Example
Input:
1
4
1
2
5
10
Output
17
hide comments
:D:
20110318 12:21:59
This problem is hidden. That means there are some issues with it, like corrupt test data or bad judge. Please choose another problem to solve. If you'll navigate through problems lists or user solved lists you should only get valid problems. If not sure, alway check the title part of the description. 

antonio081014:
20110318 07:37:32
Always get SIGABRT, don't know why... 

Radoslav Daskalov:
20100620 13:03:51
* deleted Last edit: 20100620 13:07:01 

Radhakrishnan Venkataramani:
20100618 14:36:04
Please Check The Test Case


Oleg:
20100618 06:05:23
Coach UTN FRSF, check my last submission  its only read data and print 0 and still generates SIGABRT  maybe N < 0 or too large for some case. 

[Rampage] Blue.Mary:
20100618 00:57:57
Check your test case please, I've got Accepted @ UVa. 
Added by:  Coach UTN FRSF 
Date:  20100603 
Time limit:  1s3s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: NODEJS OBJC PERL6 SQLITE VB.NET 
Resource:  http://uva.onlinejudge.org/external/100/10037.html 