#include <bits/stdc++.h>
#define ll long long
#define fr first
#define sc second
#define pb push_back
using namespace std;
int main() {
    /*ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);*/
    ll n;
    cin>>n;
    ll a[2*n+1], sm=0;
    for(ll i=1;i<=n;i++){
        cin>>a[i];
        a[n+i]=a[i];
        sm+=a[i];
    }
    ll sm0=0, sm1=0, ans=1e17, an, an1, an2;
    for(ll l=1;l<=n;l++){
        ll l2=0;
        sm0=a[l];sm1=0;
        for(ll l1=l+1;l1<l+n-1;l1++){
            if(l2<=l1+1){
                l2=max(l2, l1+1);
                sm1=a[l1];
            }
            while(sm0>sm1&&l2<l+n-1){sm1+=a[l2];l2++;}
            if(ans>max(sm0, max(sm1, sm-sm1-sm0))-min(sm0, min(sm1, sm-sm1-sm0)))ans=min(ans, max(sm0, max(sm1, sm-sm1-sm0))-min(sm0, min(sm1, sm-sm1-sm0))), an=l, an1=l1, an2=l2;
            //cout<<l<<" "<<l1<<" "<<l2<<" "<<sm1<<" "<<sm0<<" "<<sm-sm1-sm0<<endl;
            sm0+=a[l1];sm1-=a[l1];
        }

    }
    cout<<ans<<endl;
    if(an>n)an-=n;
    if(an1>n)an1-=n;
    if(an2>n)an2-=n;
    //cout<<" "<<an<<" "<<an1<<" "<<an2<<endl;
    if(an>an1)swap(an, an1);
    if(an1>an2)swap(an1, an2);
    if(an>an1)swap(an1, an);
    cout<<an<<" "<<an1<<" "<<an2;
}
/*
3
3 1 2
*/
