#include<stdio.h>
int i,cas,j,k,t,max,s,e,n,x;
main()
{
    
while(scanf("%d",&cas)!=EOF)
    {
        
for(i=0;i<cas;i++)
        {
            
if(i)printf("\n");
            printf(
"Case %d:\n",i+1);
            scanf(
"%d",&n);
            max
=-9999;
            
for(j=k=1,t=0;j<=n;j++)
            {
                scanf(
"%d",&x);
                t
+=x;
                
if(t>max)  {max=t;s=k;e=j;}
                
if(t<0)      {k=j+1;t=0;}
            }
            printf(
"%d %d %d\n",max,s,e);
        }
    }
}