
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

using namespace std;
typedef long long ll;
const ll dim=700007;
ll n,a[dim],T[dim],b[dim], c[dim], p[dim],p1,p2,p3;
string s;
/*ll build(int v, int tl, int tr){
   if(tl==tr){
        T[v]=a[tl];
        return T[v];
   }
   int tm=(tl+tr)>>1;

    T[v]=build(2*v+1, tl, tm)+build(2*v+2, tm+1, tr);
}

ll get(int v, int tl, int tr, int l, int r)
void solve(){
    cin>>n;
}*/
void solve(){
    cin>>n;
     ll sum=0;
    for(int i=1; i<=n; i++){cin>>a[i]; sum+=a[i];}
     p[0]=0;

        for(int i=1; i<=n; i++)p[i]=p[i-1]+a[i];

      ll mi=100000000000;
    for(int i=1; i<=n; i++){
        for(int j=i+1; j<=n; j++){
               for(int k=j+1; k<=n; k++){
                ll currma=max(p[j-1]-p[i-1], (p[k-1]-p[j-1]));
                ll currmi=min(p[j-1]-p[i-1], (p[k-1]-p[j-1]));
                ll mx=max(currma, sum-currmi-currma);
                ll mn=min(currmi, sum-currmi-currma);

               ll curr=mx-mn;



             //  cout << "iu94 " << i << " " << j << " " << k << endl;
                       if(curr<mi){
                        mi=curr;
                        p1=i;
                        p2=j;
                        p3=k;
                       }
               }
        }
    }


    cout << mi << endl  << p1 << " " << p2 << " " << p3 << endl;


}
int main()
{

    int t;
    t=1;
   // cin>>t;
    while(t--)solve();

    return 0;
}
