Winni is playing a card game with herself since she lost all of her friends when travelling to outer space. Winni lays
Input Specification
The first line of input contains
The next line of input contains
Output Specification
Output the maximum amount of money she can obtain.
Constraints
Subtask 1 [10%]
Subtask 2 [20%]
Subtask 3 [30%]
Subtask 4 [40%]
No additional constraints.
Sample Input
7 10 5
10 8 9 10 9 9 10
Sample Output
4
Explanation For Sample
- She can initially pick up
10
gaining dollars. - She picks up
9
, gaining dollars. - She then picks up
10
, gaining dollar. - She picks up
10
again, gaining dollars. - She picks up
9
again, gaining dollar.
In total, she gains
Comments