Score : $400$ points
Takahashi is going to cook $N$ dishes called Dish $1$ through $N$.
Dish $i$ can be cooked by using an oven for $T_i$ consecutive minutes. An oven cannot be used for two or more dishes simultaneously.
If Takahashi has two ovens to use, what is the shortest number of minutes needed to cook all the $N$ dishes? Assume that all processes other than using ovens take negligible time.
Input is given from Standard Input in the following format:
$N$ $T_1$ $\ldots$ $T_N$
Print the answer.
5 8 3 7 2 5
13
We can, for example, use the two ovens as follows to cook all the dishes in $13$ minutes.
2 1000 1
1000
9 3 14 15 9 26 5 35 89 79
138