javaHDU1003Max Sum
import java.util.Scanner;
public class Sum
{public static void main(String args[])
{Scanner cin=new Scanner(System.in);
int T,N,num,startp=1,endp=1;
T=cin.nextInt();
int m=T;
while(T-->0)
{int max=-1001,temp=1,sum=0;
N=cin.nextInt();
for(int i=1;i<=N;i++)
{num=cin.nextInt();
sum+=num;
if(sum>max)
{max=sum;
startp=temp;
endp=i;
}
if(sum<0)
{sum=0;
temp=i+1;
}
}
System.out.println("Case "+(m-T)+":");
System.out.println(max+" "+startp+ " "+endp);
if(T!=0)
{System.out.println();
}
}
}
}