#include <bits/stdc++.h>

using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int n;cin >> n;
    ll a[n+1];
    for(int i=1; i<=n; i++) {cin >> a[i]; }
    ll p[n+1];
    ll ans=1000000000000000000;
    int ansx, ansy,ansz;
    p[0]=0;
    for(int i=1; i<=n; i++)
    {
        p[i]=p[i-1]+a[i];
    }
    for(int x=1; x<=n-2; x++)
    {
        for(int y=x+1; y<=n-1; y++)
        {
            for(int z=y+1; z<=n; z++)
            {
                ll s1=p[y-1]-p[x-1];
                ll s2=p[z-1]-p[y-1];
                ll s3=p[x-1]+p[n]-p[z-1];
                ll ans1=(max(s1,max(s2,s3)) - min(s1,min(s2,s3)));
                if(ans>ans1){ans=ans1; ansx=x; ansy=y; ansz=z;}
            }
        }
    }
    cout << ans << endl << ansx << ' ' << ansy << ' ' << ansz;
}
