#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>


using namespace std;
#define ll long long
#define endl '\n'
#define itn int

const long long oo=1000000000000;
const long long N=3000005;


int main()
{

//    ios_base::sync_with_stdio(0);
//    cin.tie(0);
//    cout.tie(0);

//
//    ll test;
//    cin>>test;
//    while(test--)
    {

        ll n;
        cin>>n;
        ll xx=0,yy=0,zz=0;
        ll sum[n];
        ll a;
        for(itn i=0; i<n; i++)
        {

            cin>>a;
            if(i==0)sum[i]=a;
            else
            sum[i]=sum[i-1]+a;
        }
        ll x,y,z;
        ll mn=oo;
        for(itn i=0; i<n; i++)
        {

            for(int j=0; j<n; j++)
            {
                if(i==j)continue;


                for(itn u=0; u<n; u++)
                {
                    if(i==u || u==j)continue;


                   x=i;
                   y=j;
                   z=u;
                    ll p;
                    ll pp;
                    // cout<<x<<" "<<y<<" "<<z<<endl;
                    if(x>y)swap(x,y);
                    if(y>z)swap(y,z);
                    if(x>y)swap(x,y);


                    if(x-1>=0) p=sum[y-1]-sum[x-1];
                    else p=sum[y-1];
                    p=max(p,sum[z-1]-sum[y-1]);
                    if(x-1>=0)
                    p=max(p,sum[n-1]-sum[z-1]+sum[x-1]);
                    else  p=max(p,sum[n-1]-sum[z-1]);

                    if(x-1>=0) pp=sum[y-1]-sum[x-1];
                    else pp=sum[y-1];
                    pp=min(pp,sum[z-1]-sum[y-1]);
                    if(x-1>=0)
                    pp=min(pp,sum[n-1]-sum[z-1]+sum[x-1]);
                    else  pp=min(pp,sum[n-1]-sum[z-1]);

                   // cout<<p<<" "<<pp<<" "<<x<<" "<<y<<" "<<z<<endl;
                    if(mn>p-pp)
                    {


                        mn=p-pp;
                        xx=x;
                        yy=y;
                        zz=z;
                    }
                }
            }

        }
        cout<<mn<<endl;
        cout<<xx+1<<" "<<yy+1<<" "<<zz+1;


    }

}
