#include <stdio.h>
#include <string.h>
int a[100123];
int last[100123];
int f[100123];
int T,le,ri,ans;
int init()
{
int i,n;
memset(a,0,sizeof(a));
memset(f,0,sizeof(f));
memset(last,0,sizeof(last));
scanf("%d",&n);
for (i=1; i<=n; i++)
scanf("%d",&a[i]);
return n;
}
void print(int t)
{
printf("Case %d:\n",t);
printf("%d %d %d\n",ans,le,ri);
if (t!=T) printf("\n");
}
void work(int t)
{
int i,n,max,index;
n=init();
max=f[n]=a[n];
index=last[n]=n;
for (i=n-1; i>=1; i--)
{
if (f[i+1]>0)
{
f[i]=a[i]+f[i+1];
last[i]=last[i+1];
}
else
{
f[i]=a[i];
last[i]=i;
}
if (f[i]>=max)
{
index=i;
max=f[i];
}
}
le=index;ri=last[index];ans=f[index];
print(t);
}
int main()
{
int i;
scanf("%d",&T);
for (i=1; i<=T; i++)
work(i);
}