#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int T, n;
    scanf("%d", &T);
    for (int t = 1; t <= T; t++)
    {
        scanf("%d", &n);
        int ans = INT_MIN, tmp = 0;
        int st = 0, ed = 0, cst = 1;
        for (int i = 1, x; i <= n; i++)
        {
            scanf("%d", &x);
            tmp += x;
			if (tmp < 0)
				cst = i;
            if (tmp > ans)
                st = cst, ed = i, ans = tmp;
            if (tmp < 0)
                tmp = 0;
        }
        printf("Case %d:\n%d %d %d\n", t, ans, st, ed);
        if (T != t) puts("");
    }
    return 0;
}
