#include
using namespace std;
int main(){
int count =0;
int test;
cin>>test;
while(1){
int n;
cin>>n;
int max=0;
int a[1000];
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
int current=0;
for(int k=i;k<=j;k++){
current=a[k]+current;
}
if(current>max){
max=current;
}
}
}
cout<<max;
count++;
cout<<endl;
if(count==test){
break;
}
}
return 0;
}