n = int(input())
nums = list(map(int, input().split()))

sums = [0, 0, 0]

minSum = float('inf')
maxs = [-1, -1, -1]

for x in range(n):
    for y in range(x+1, n):
        sums[0] = sum(nums[x:y])
        for z in range(y+1, n):
            sums[1] = sum(nums[y:z])
            sums[2] = sum(nums[z:n] + nums[0:x])
            temp = max(sums) - min(sums)
            if minSum > temp:
                minSum = temp
                maxs = [x, y, z]

print(minSum)
for i in maxs:
    print(i + 1, end = ' ')