n = int(input())
arr = list(map(int,input().split()))
pref = [0] * (n+1)

for i in range(n):
    pref[i+1] = pref[i]+arr[i]

k_min = pref[n]
vr = [0,0,0]
for x in range(0,n+1):
    for y in range(x+1,n+1):
        for z in range(y+1,n+1):
            var = [x+1,y+1,z+1]
            v = [(pref[y] - pref[x]),(pref[z] - pref[y]),(pref[n] - pref[z] + pref[x])]
            k = max(v) - min(v)
            if k < k_min:
                k_min = k
                vr = var

print(k_min)
print(*vr)