Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

Problem hidden on 2010-06-22 15:50:29 by Oleg

CRUCE - Crossing the bridge

no tags 

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: 2011-03-18 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: 2011-03-18 07:37:32

Always get SIGABRT, don't know why...

Radoslav Daskalov: 2010-06-20 13:03:51

* deleted

Last edit: 2010-06-20 13:07:01
Radhakrishnan Venkataramani: 2010-06-18 14:36:04

Please Check The Test Case

Oleg: 2010-06-18 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: 2010-06-18 00:57:57

Check your test case please, I've got Accepted @ UVa.


Added by:Coach UTN FRSF
Date:2010-06-03
Time limit:1s-3s
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