Given a sequence of integers of length n, a1, a2... , an.
Now select a strictly ascending subsequence of this sequence, requiring that the sum of the elements of the selected subsequence be as large as possible.
What is the maximum value?
The first line contains the integer n.
The second line contains n integers a1, a2... , an.
(1≤n≤105,1≤ai≤109)
Output the sum of the largest ascending subsequence.
4 1 9 7 10
20 hint: For example, we pick 1,9,10.