/*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];
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;G++) for(int H=G+1;H<=n;H++) for(int J=H+1;J<=n;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;
        }
    }
    cout<<best<<"\n"<<x<<" "<<y<<" "<<z;


    return 0;
}
