The UPC team 12 seconds could barely train for the World Finals. For instance, sometimes only Ferran and Ángel could join for a training. In those cases, a possible strategy was to make Ferran think about how to solve the problems, and to make Ángel program the solutions previously found and written down on paper by Ferran.
Supose that a training had problems. Let be the time that Ferran needed to solve the -th problem, and be the time that Ángel needed to program the -th problem. Both Ferran and Ángel could only perform one task at a time, but could decide the order of thinking and the order of programming, with just one restriction: Ferran had to completely solve a problem before Ángel could start programming its solution.
Given all this information, can you please minimize the total time to solve and program all the problems?
Input consists of several cases, each one with followed by , followed by . Assume , and that all and are between 1 and .
For every case, print the minimum time to solve and program all the problems.
Input
2 80 90 100 100 4 4 4 4 4 1 2 4 6 5 5 1 2 3 6 3 1 3 5 5 3 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
Output
280 17 20 4000000000