import sys

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

sums = [0, 0, 0]

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

for x in range(n):
    sums[0] = 0
    for y in range(x+1, n):
        sums[0] += nums[y-1]
        sums[1] = 0
        for z in range(y+1, n):
            sums[1] += nums[z-1]
            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 = ' ')