Jianguo Trump performs tasks in country A, he has performed n(0<n<1000) tasks in one year, and the value of the i-th task is vi(0<vi<1e5), the more value of the task is, the more contribute to C country. Now he wants to report some of these tasks to country C, but he wants to show that he has made progress every time, so each task he reports will bring more economic growth than the last task, i.e. vi>vj, i > j. What is the maximum total value of the tasks he reports?
输入描述:
The input contains multiple test cases. Each test case includes 2 lines.
The first line is a positive integer n, the second line include n positive integers ai.
输出描述:
For each case, print the result in one line.
示例1
说明
Jianguo Trump can report 6, 8 to get the max value 14
示例2
说明
Jianguo Trump can report 3, 7, 8 to get the max value 18