import sys
n = int(sys.stdin.readline())
a=[int(i) for i in sys.stdin.readline().split()]
mid=sum(a)/n
grfinal=[[float('inf')],[0],[0]]
for i in range(n):
    gr=[[0],[0],[0]]
    used=[0]*n
    k=i
    for j in range(3):
        while gr[j][0]+a[k]<=mid and used[k]==0:
            gr[j].append(k)
            gr[j][0]+=a[k]
            used[k]=1
            k+=1
            if k>n-1:
                k=0
    while used[k]==0:
        if gr[0]==min(gr):
            gr[0].append(k)
            gr[0][0]+=a[k]
        elif gr[1]==min(gr):
            gr[1].append(k)
            gr[1][0]+=a[k]
        else:
            gr[2].append(k)
            gr[2][0]+=a[k]
        used[k]=1
        k+=1
        if k>n-1:
            k=0
    if max(grfinal)[0]-min(grfinal)[0]>max(gr)[0]-min(gr)[0]:
        grfinal=gr
print(max(grfinal)[0]-min(grfinal)[0])
for i in grfinal:
    print(i[1],end=' ')

