import sys
n = int(input())
arr = [None] + list(map(int,sys.stdin.readline().split()))
s = [None]+[0]*n
s[1] = arr[1]
for i in range(2,n+1):
    s[i]+=s[i-1]
    s[i]+=arr[i]
def summa(l,r):
    #print(l,r)
    if r > l:
        if l > 1:return s[r-1]-s[l-1]
        else:return s[r-1]
    else:
        if r == 1:return summa(l,n+1)
        else:return summa(1,r)+summa(l,n+1)
ans = [-1,-1,-1]
mins = [-float('inf'),0,float('inf')]
#print('LMAOOOOOOOOOO')
for i in range(1,n+1):
    for j in range(i+1,n+1):
        for k in range(j+1,n+1):
            s1 = summa(i,j)
            s2 = summa(j,k)
            s3 = summa(k,i)
            if max(s3,s2,s1) - min(s3,s2,s1) < max(mins) - min(mins):
                mins = [s1,s2,s3]
                ans = [i,j,k]
print(max(mins) - min(mins))
print(*ans)
