#include <STDIO.H>
typedef struct SU_tag{
SU_tag(){}
SU_tag(int a,int b,int c):max_sum(a),left(b),right(c){}
int max_sum;
int left;
int right;
}SU; SU find_max_crossing_subarray(int *a,int low,int mid,int high)
{
int left,left_max=a[mid],right,right_max=a[mid+],i,sum;
sum=;
for(i=mid;i>=low;i--){
sum+=a[i];
if(sum>=left_max){
left_max=sum;
left = i;
}
}
sum=;
for(i=mid+;i<=high;i++){
sum+=a[i];
if(sum>=right_max){
right_max = sum;
right = i;
}
}
return SU(left_max+right_max,left,right);
} SU find_max_subarray(int *a,int low,int high)
{
SU left,right,cross;
if(low == high){
return SU(a[low],low,high);
}else{
int mid = (low+high)/;
left = find_max_subarray(a,low,mid);
right = find_max_subarray(a,mid+,high);
cross = find_max_crossing_subarray(a,low,mid,high);
}
if(left.max_sum>=right.max_sum && left.max_sum>=cross.max_sum)
return left;
else if(cross.max_sum>=left.max_sum && cross.max_sum>=right.max_sum)
return cross;
else
return right;
} int main()
{
int t,n,i;
scanf("%d",&t);
i = ;
while(i<=t){
scanf("%d",&n);
int m=,*a=new int[n];
for(;m<n;m++)
scanf("%d",&a[m]);
SU r = find_max_subarray(a,,n-);
printf("Case %d:\n",i);
printf("%d %d %d\n",r.max_sum,r.left+,r.right+);
if(i!=t)
printf("\n");
delete a;
i++;
}
return ;
}