#include <iostream>
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define endl "\n"
//#define vector<ll> vll;
//#define fi first;
//#define se second;
//#define pb push_back;
typedef pair<ll, ll> pll;
const ll dim=1e6+6;
ll n, t;
string s;
ll a[dim];
ll pr[dim], vis[dim];
deque<ll> dq;
ll ans=0;
ll cur=0;


int main()
{
    ll x, y, cnt;
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   // cin>>t;
   t=1;
    while(t--){
        cin>>n;

        ll cur=0;
        for(int i=1; i<=n; i++){
            cin>>a[i];
            pr[i]=pr[i-1]+a[i];
        }
        ll bi, bj, bk;
        ans=1e17;
        for(int i=1; i<=n; i++){
            ll ad=pr[i-1];
            for(int j=i+1; j<=n; j++){
                for(int k=j+1; k<=n; k++){
                    ll s1=pr[j-1]-pr[i-1];
                    ll s2=pr[k-1]-pr[j-1];
                    ll s3=ad+pr[n]-pr[k-1];
                   // cout<<i<<" "<<j<<" "<<k<<endl;
                    //cout<<s1<<" "<<s2<<" "<<s3<<endl;
                   // cout<<endl;
                    ll mxc=max(max(s2, s3), s1);
                    ll mnc=min(min(s2, s3), s1);
                    if(mxc-mnc<ans){
                        ans=mxc-mnc;
                        bi=i;
                        bj=j;
                        bk=k;
                    }
                }
            }
        }
        cout<<ans<<endl;
        cout<<bi<<" "<<bj<<" "<<bk<<endl;



    }


    return 0;
}
