#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define lf long double
#define all(vec) vec.begin(), vec.end()
#define rall(vec) vec.rbegin(), vec.rend()
#define nl "\n"
#define chmyax(a,b) a=max(a,b)
#define chmyin(a,b) a=min(a,b)

struct boy{
    ll a;
    ll b;
    ll c;
};

struct pair_hash{
    size_t operator()(pair<ll,ll> pr) const {
        return hash<ll>()(pr.first)^hash<ll>()(pr.second);
    }
};


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("in","r",stdin);
    ll a,b,c,d,e,f,g;
    ll t;
    ll n;
    cin>>n;
    vector<ll> arr(n);
    vector<ll> prefix(n+1);
    prefix[0]=0;
    for (ll i=0;i<n;i++){
        cin>>arr[i];
        prefix[i+1]=prefix[i]+arr[i];
    }
    function<ll(ll,ll)> get_sum=[&](ll l, ll r){
        if (r<0)r+=n;
        if (l<0)l+=n;
        if (r>=n)r-=n;
        if (l>=n)l-=n;
        if (l<=r)return prefix[r+1]-prefix[l];
        return prefix[n]-(prefix[l]-prefix[r+1]);
    };
    ll best_score=1e9;
    vector<ll> answer={0,1,2};
    for (ll i=0;i<n;i++){
        for (ll j=i+1;j<n;j++){
            for (ll l=j+1;l<n;l++){
                ll sum1=get_sum(i,j-1);
                ll sum2=get_sum(j,l-1);
                ll sum3=get_sum(l,i-1);
                ll mx_sm=max(sum1,max(sum2,sum3));
                ll mn_sm=min(sum1,min(sum2,sum3));
                ll score=mx_sm-mn_sm;
                if (score<best_score){
                    best_score=score;
                    answer={i,j,l};
                }
            }
        }
    }
    cout<<best_score<<nl;
    cout<<answer[0]+1<<" "<<answer[1]+1<<" "<<answer[2]+1;
}