n = int(input())
mass = list(map(int, input().split()))
cuts = []

def solve_next(curr, mult, mass):
    """Рахує наступний індекс єлементу"""
    next = curr + mult
    if next > len(mass) - 1:
        next = next - len(mass)

    return next

def best_combo(maxsum, mass):
    """Знаходить найкращі комбінації"""
    global allsum
    startindexes = {}

    for j in range(len(mass)):
        allsum = 0
        for i in range(0, len(mass)):
            allsum += mass[solve_next(i, j, mass)]
            if allsum >= maxsum:
                if allsum in startindexes:
                    startindexes[allsum] = [*startindexes[allsum], j + 1]
                else:
                    startindexes[allsum] = [j + 1]
                break
    return startindexes

maxsum = sum(mass) // 3
move = 0

# DEBUG print('now', i, mass[solve_next(i, j, mass)], 'mult', j, 'sum', allsum)
#startindexes = {14: [0, 4], 11: [1, 5, 6], 10: [2, 7], 15: [3]},
#sums = [4, 1, 0, 5, 4, 1, 1, 0]

used = []
best = best_combo(maxsum, mass)
combos = []
for i in sorted(best):
    combos.extend(best[i])
    used.append(i)
    if len(combos) >= 3:
        break

print(max(used) - min(used))
print(' '.join(list(map(str, combos))))

# за 3 години 49 строк кода ура