Showing:
Handle Score
@Ibrahim Nash 5725
@akhayrutdinov 5111
@mb1973 4989
@Quandray 4908
@saiujwal13083 4156
@sanjay05 3762
@marius_valentin_dragoi 3511
@sushant_a 3453
@KshamaGupta 3318
@the_coder95 3302
Greedy Fox
Easy Accuracy: 43.19% Submissions: 1405 Points: 2

A Fox is looking to collect some coins placed in a line. The fox is very greedy and follows an unusual way of collecting coins. The Fox has decided that it will collect coins in an increasing order only since she always craves for more money and all the coins must be contiguous. It wants to maximize the amount of money it collects. Each coin has its value printed on it.
Unfortunately, the Fox is greedy but not intelligent enough to find the solution and asks you for help. Print the maximum amount of money it will take home. You are given the value of each coin in an array in the order in which the coins are placed.

Input:
The first line of input contains an integer T denoting the number of test cases. Each test case contains the number of elements in the array a[] as n and next line contains space separated n elements in the array.

Output:
Print an integer which is the required answer.

Constraints:
1<=T<=100
1<=n<=1000
1<=a[i]<=100000

Example:
Input:

2
6
2 1 4 7 3 6
5
38 7 8 10 12

Output:
12
38