#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

typedef long long ll;
int const N=1e7+7;
ll n,p[N];

int main() {

    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    cin>>n;
    for(int i=1;i<=n;i++) {
        ll a;
        cin>>a;
        p[i]=p[i-1]+a;
    }

    int mii;
    if(n/3==0) mii=0;
    else mii=1;

    ll mi=1e17+7, mix, miy, miz;
    for(ll x=1;(x<n-1 && mi>mii);x++) for(ll y=x+1;(y<n && mi>mii);y++) for(ll z=y+1;z<=n;z++) {
        ll sx=p[y-1]-p[x-1];
        ll sy=p[z-1]-p[y-1];
        ll sz=p[n]-sx-sy;
        ll r=max(max(sx,sy),sz)-min(min(sx,sy),sz);
        if(r<mi) {
            mi=r;
            mix=x;
            miy=y;
            miz=z;
            if(mi==mii) break;
        }
    }


    cout<<mi<<endl<<mix<<" "<<miy<<" "<<miz<<endl;

    return 0;
}
