Bob is creating a snow army to take over the world! Currently, he has
You may have heard the old saying that a chain is as strong as its weakest link. This is true for snow armies. The strength of a snow army is equal to the height of the shortest snowman in the army.
Bob has agreed to spare you if you help him. He wants to know the maximum strength his army can obtain with the remaining snow. Can you save yourself?
Constraints
For all subtasks:
Subtask 1 [20%]
Subtask 2 [30%]
Subtask 3 [50%]
No additional constraints.
Input Specification
The first line will contain three space-separated integers
The next line will contain
Output Specification
Output the maximum possible strength.
Sample Input 1
5 2 2
4 3 1 3 4
Sample Output 1
3
Explanation for Sample 1
Bob can first increase the second and third snowmen's heights by
4 4 3 4 4
so the strength of this army is
Sample Input 2
5 3 1
2 3 3 4 2
Sample Output 2
2
Comments