| 3725 - Hie with the Pie North America - East Central - 2006/2007 | |||||
| Submit | Ranking | ||||
The Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can afford to hire only one driver to do the deliveries. He will wait for 1 or more (up to 10) orders to be processed before he starts any deliveries. Needless to say, he would like to take the shortest route in delivering these goodies and returning to the pizzeria, even if it means passing the same location(s) or the pizzeria more than once on the way. He has commissioned you to write a program to help him.
Input will consist of multiple test cases. The first line will contain
a single
integer n
For each test case, you should output a single number indicating the
minimum time to deliver
all of the pizzas and return to the pizzeria.
n
10
Output
Sample Input
3
0 1 10 10
1 0 1 2
10 1 0 10
10 2 10 0
0
Sample Output
8
East Central 2006-2007