#include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
int cases=1;
while(t--)
{
int n,i;
scanf("%d",&n);
int sum=0,max=-9999;
int start=1,end=1,tmp=1;
int dp[100020];
for(i=1;i<=n;i++)
{
scanf("%d",&dp[i]);
sum+=dp[i];
if(max<sum)
{
max=sum;
start=tmp;
end=i;
}
if(sum<0)
{
sum=0;
tmp=i+1;
}
}
printf("Case %d:\n",cases);
printf("%d %d %d\n",max,start,end);
if(t!=0)
printf("\n");
cases++;
}
return 0;
}