import sys

n = int(sys.stdin.readline())
nums = list(map(int, sys.stdin.readline().split()))

res = 100000
min_x = 1
min_y = 2
min_z = 3

def doeswork(nums, x, y, z):
    reslist = (sum(nums[x:y]),sum(nums[y:z]),sum(nums[z:len(nums)])+sum(nums[0:x]))
    #print(reslist)
    return max(reslist) - min(reslist)

for x in range(len(nums)):
    for y in range(len(nums)-x-1):
        for z in range(len(nums)-x-y-1):
            q, n, m = x,y+x+1,z+y+x+2
            #print(res)
            #print(q, n, m)
            if res > doeswork(nums, q, n, m):
                res = doeswork(nums, q, n, m)
                min_x = q+1
                min_y = n+1
                min_z = m+1

#print('-')
print(res)
print(min_x+1,min_y+1,min_z+1)