Problem G
Pripreme
Ante and Goran are preparing
You are given the time it takes for each team to understand and implement an algorithm. Each algorithm lecture has to be done without interruption. Determine the minimal time required for Ante and Goran to do their lectures!
For additional explanation, consult the sample test clarifications.
Input
The first line of input contains the integer
The following line contains
All numbers in the input belong to the interval
Output
The first and only line of output must contain the required number from the task.
Clarification of the first example:
Each team needs
Clarification of the second example:
One of the optimal schedules is that Ante gives lectures to
team
Sample Input 1 | Sample Output 1 |
---|---|
3 2 2 2 |
6 |
Sample Input 2 | Sample Output 2 |
---|---|
3 4 1 2 |
8 |
Sample Input 3 | Sample Output 3 |
---|---|
4 1 3 2 1 |
7 |