Maximum Subarray Sum

No attempts yetTime limit1sMemory limit256 MB

Problem

Given an integer array XX of size NN, find the maximum sum of any contiguous subarray. That is, compute max1ijN(X[i]++X[j])\max_{1 \le i \le j \le N} (X[i] + \cdots + X[j]).

Input

The first line contains the number of test cases TT. Each test case has one line with N$$(1 \le N \le 1000), then a line with NN integers separated by spaces, each with absolute value less than 10001000.

Output

For each test case, print the maximum subarray sum on its own line.