class T1003
{
public static void main(String[] args)
{
java.util.Scanner cin = new java.util.Scanner(System.in);
int n = cin.nextInt();//测试数据
int b = 0;
while(b!=n)
{
b++;
int num = cin.nextInt();
int[] array = new int[num];
//输入数组
for(int i = 0;i<num;i++)
array[i] = cin.nextInt();
//求最大子序列的和
long maxNum = -1001,currentNum = 0;
int start = 0,end = 0;
for(int i = 0 ,j = i;j<num;j++)
{
currentNum += array[j];
if(maxNum<currentNum)
{
start = i;
end = j;
maxNum = currentNum;
}
else
{
if(currentNum<0)
{
i = j + 1;
currentNum = 0;
}
}
}
System.out.println("Case "+b+":");
System.out.println(maxNum+" "+(start+1)+" "+(end+1));
if(b!=n)
System.out.println();
}
}
}