def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    x = 0
    y = 1
    z = n-1
    r_p = 10e18
    for i in range(1, n-1):
        r = max(sum(a[x:y]), sum(a[y:z]), a[n-1]) - min(sum(a[x:y]), sum(a[y:z]), a[n-1])
        if r <= r_p:
            r_p = r
            y += 1
        else:
            break
    r = max(sum(a[x:y]), sum(a[y:z]), a[n - 1]) - min(sum(a[x:y]), sum(a[y:z]), a[n - 1])
    if r < r_p:
        r_p = r

    r_p = 10e18
    for i in range(0, y):
        r = max(sum(a[x:y]), sum(a[y:z]), sum(a[0:x]) + a[n-1]) - min(sum(a[x:y]), sum(a[y:z]), sum(a[0:x]) + a[n-1])
        if r < r_p:
            r_p = r
            x += 1
        else:
            break
    r = max(sum(a[x:y]), sum(a[y:z]), sum(a[0:x]) + a[n - 1]) - min(sum(a[x:y]), sum(a[y:z]), sum(a[0:x]) + a[n - 1])
    if r < r_p:
        r_p = r

    r_p = 10e18
    for i in range(0, y):
        r = max(sum(a[x:y]), sum(a[y:z]), sum(a[0:x]) + sum(a[y+1:z+1])) - min(sum(a[x:y]), sum(a[y:z]), sum(a[0:x]) + sum(a[y+1:z+1]))
        if r < r_p:
            r_p = r
            z -= 1
        else:
            break
    r = max(sum(a[x:y]), sum(a[y:z]), sum(a[0:x]) + sum(a[y + 1:z + 1])) - min(sum(a[x:y]), sum(a[y:z]),sum(a[0:x]) + sum(a[y + 1:z + 1]))
    if r < r_p:
        r_p = r
    print(r_p)
    print(x+1, y+1, z+1)



if __name__ == '__main__':
    main()
