/*IN FISH AT EGOI I TRUST*/
/*IN FISH AT EGOI I TRUST*/
/*IN FISH AT EGOI I TRUST*/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppl;
typedef long double ld;

mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
/*#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,popcnt")*/

ll mod,n,best,x,y,z,a[1000009],b[1000009],mi,ma;
void check(ll G,ll H,ll J){
     ll S=b[H-1]-b[G-1];
        ll T=b[J-1]-b[H-1];
        ll K=b[n]-S-T;
        if(max({S,T,K})-min({S,T,K})<best){
            best=max({S,T,K})-min({S,T,K});
            x=G; y=H; z=J;
        }
}
ll next(ll x){
   if(x==n) return 1;
   else return x+1;
}
ll pre(ll x){
   if(x==1) return n;
   else return x-1;
}
ll f(ll L,ll R){
    if(L>R) return b[n]-b[L-1]+b[R];
   return b[R]-b[L-1];
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    mod=1e15;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) b[i]=b[i-1]+a[i];
    best=mod; x=-1; y=-1; z=-1;

    for(int G=1;G<=n-2;G++) {
            ll M=G+2;
            for(int H=G+1;H<=n-1;H++){
                while(M+1<=n && f(H,M+1)<=f(next(M+1),pre(G))) M++;
               // cout<<G<<" "<<H<<" "<<M<<endl;
                check(G,H,M);
                if(M!=n) check(G,H,M+1);
                if(M<=n-2) check(G,H,M+2);
                if(M-1!=H) check(G,H,M-1);
            }
    }

    cout<<best<<"\n"<<x<<" "<<y<<" "<<z;


    return 0;
}
