1729 - LL && the Best Segment

Time Limit : 1 Second

Memory Limit : 64 MB

Submission: 5

Solved: 2

Description

There is a sequence of n number. A Function f(l,r) is defined as the sum of all the numbers in this sequence from l to r. Function g(l,r) is defined as the sum of the all value of f(i,j)(l≤i≤j≤r). You need to find the maximum value of g(l,r)(1≤l≤r≤n).  For example, there is a sequence {1,2,3,4,5}.  The maximum value of g(l,r)is g(1,5)=f(1,1)+f(2,2)+f(3,3)+f(4,4)+f(5,5)+f(1,2)+f(2,3)+f(3,4)+f(4,5)+f(1,3)+f(2,4)+f(3,5)+f(1,4)+f(2,5)+f(1,5)=105.

Input

The first line of input contains a single integer t(1≤t≤50), the number of test cases. The first line of each test case contains an integer N(1≤N≤1000), the next line is n number ai (|ai |<=100).

Output

For each test case, the first line print a line whit format “Case #t:”, in which  is the number of test cases.


 


       The second line print three numbers ,  and ,in which  is the maximum value of ,  and  are start position and end position. If there multiple answer, output the one with the minimum lexicographic order.

sample input
2
3
1 -2 3
5
1 1 -5 2 2
sample output
Case #1:
4 1 3
Case #2:
8 4 5
hint
source
WUST
© 2015 HUST ACMICPC TEAM. All Right Reserved.