#include<iostream>
#include<vector>
using namespace std;
vector<int>a;
int couts=1;
void calculate(int x)
{
int MAX,LEFT,RIGHT,left,leftmax,i,sum=0;
left=LEFT=RIGHT=1;
leftmax=MAX=a[0];
for(i=1;i<x;i++)
{
if(leftmax+a[i]>=a[i])
{
leftmax=leftmax+a[i];
}
else
{
leftmax=a[i];
//left=i+1;
}
if(leftmax>MAX)
{
MAX=leftmax;
//LEFT=left;
RIGHT=i+1;
}
}
for(int i = RIGHT-1; i >= 0 ; i--)
{
sum+=a[i];
if(sum ==MAX )
{
LEFT=i+1;
}
#include<vector>
using namespace std;
vector<int>a;
int couts=1;
void calculate(int x)
{
int MAX,LEFT,RIGHT,left,leftmax,i,sum=0;
left=LEFT=RIGHT=1;
leftmax=MAX=a[0];
for(i=1;i<x;i++)
{
if(leftmax+a[i]>=a[i])
{
leftmax=leftmax+a[i];
}
else
{
leftmax=a[i];
//left=i+1;
}
if(leftmax>MAX)
{
MAX=leftmax;
//LEFT=left;
RIGHT=i+1;
}
}
for(int i = RIGHT-1; i >= 0 ; i--)
{
sum+=a[i];
if(sum ==MAX )
{
LEFT=i+1;
}
}
cout<<"Case "<<couts++<<":\n"<<MAX<<' '<<LEFT<<' '<<RIGHT<<"\n";
}
int main()
{
int n,x,x1,i;
cin>>n;
while(n-->0)
{
cin>>x;
a.resize(x);
x1=x;
i=0;
while(x1-->0)cin>>a[i++];
calculate(x);
if(n)cout<<'\n';
}
return 0;
}
cout<<"Case "<<couts++<<":\n"<<MAX<<' '<<LEFT<<' '<<RIGHT<<"\n";
}
int main()
{
int n,x,x1,i;
cin>>n;
while(n-->0)
{
cin>>x;
a.resize(x);
x1=x;
i=0;
while(x1-->0)cin>>a[i++];
calculate(x);
if(n)cout<<'\n';
}
return 0;
}