Mr.Hsiung dresses fashionably everyday. Not surprisingly, he only does this because he is overly conscious about his height. He has a sequence of ~N~ integers, each representing his height at a certain time. However, he organized them poorly. Mr.Hsiung doesn't care about having all of the heights, so he will take some of them, while keeping their relative order. Additionally, this new subsequence of numbers he has must be strictly increasing, as it wouldn't make sense for him to grow shorter. He also wants the sequence with the sum of its elements being maximal. Help Mr.Hsiung find this sum.
The first line contains the integer ~N~ ~(1 \leq N \leq 1000)~, the number of elements in the original sequence. The ~N~ lines will contain ~N~ elements, a positive integer at most ~1000~. For ~50~% of test cases, ~1 \leq N \leq 10~.
Output the maximum sum of Mr.Hsiung's new sequence.
Sample Input 1
5 4 1 2 5 6
Sample Output 1
In this case, the subsequence ~4, 5, 6~ is optimal.
Sample Input 2
5 10 9 8 7 6
Sample Output 2
In this case, no subsequence containing more than 1 element is increasing. Thus, choosing ~10~ is optimal.