#include <iostream>
constexpr int MAX_ARY_SIZE = 100;
using namespace std;
int main()
{
int case_num;
while(cin >> case_num){
while(case_num --){
int input_num;
cin >> input_num;
int input[MAX_ARY_SIZE];
for(int i = 0; i < input_num; i+=1)
cin >> input[i];
int maximum = input[0];
for(int i = 1; i<input_num; i+=1){
if(input[i-1] > 0)
input[i] += input[i-1];
if(input[i] > maximum)
maximum = input[i];
}
cout << maximum << endl;
}
}
return 0;
}