import sys

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

res = 100000

if n == 3:
    print(max(nums[0], nums[1], nums[2]) - min(nums[0], nums[1], nums[2]))
    print(1,2,3)
else:
    for x in range(0, len(nums)-2):
        for y in range(x+1, len(nums)-1):
            #first z cycle to optimize :D
            z = y + 1
            sum_x, sum_y, sum_z = sum(nums[x:y]), sum(nums[y:z]), sum(nums[z:len(nums)]) + sum(nums[0:x])
            for z in range(y+2, len(nums)):
                sum_y, sum_z = sum_y+nums[z-1], sum_z-nums[z-1]
                yeah = max(sum_x, sum_y, sum_z) - min(sum_x, sum_y, sum_z)
                if yeah < res:
                    res = yeah
                    min_x, min_y, min_z = x+1, y+1, z+1

    print(res)
    print(min_x, min_y, min_z)