n=int(input())
m=list(map(int,input().split()))
x,y,z=0,0,0
c=[]
for i in range(n-1):
    x=i
    for j in range(n-i-1):
        y=j+x+1
        for q in range(n-i-j-1):
            z=q+y+1
            xsum=sum(m[x:y])
            ysum=sum(m[y:z])
            zsum=sum(m[z:n]+m[0:x])
            c.append(max(xsum,ysum,zsum)-min(xsum,ysum,zsum))
k=-1
T=True
for i in c:
    if T:
        k+=1
        if i==min(c):
            T=False
#print(k)
k1=-1
for i in range(n-1):
    if k1==k:
        break
    x=i
    for j in range(n-i-1):
        if k1==k:
            break
        y=j+x+1
        for q in range(n-i-j-1):
            if k1==k:
                break
            z=q+y+1
            k1+=1
print(min(c))
print(x+1,y+1,z+1)
