#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

ll n;
ll a[1000001];

void go()
{
    cin>>n;
    for(ll i = 1; i <= n; i++){
        ll x;
        cin>>x;
        a[i] = a[i - 1] + x;
    }

    ll ans = 1000000000000000000, x, y, z;
    for(ll i = 1; i <= n - 2; i++)
    {
        for(ll j = i + 1; j <= n - 1; j++)
        {
            for(ll g = j + 1; g <= n; g++)
            {
                ll mx, mn;
                mn = mx = a[j - 1] - a[i - 1];
                mx = max(mx, a[g - 1] - a[j - 1]);
                mx = max(mx, a[n] - a[g - 1] + a[i -  1]);
                mn = min(mn, a[g - 1] - a[j - 1]);
                mn = min(mn, a[n] - a[g - 1] + a[i -  1]);
                if(ans > mx - mn)
                {
                    ans = mx - mn;
                    x= i, y= j, z= g;
                }
            }
        }
    }

    cout<<ans<<'\n'<<x<<' '<<y<<' '<<z<<'\n';
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int test_cnt = 1;
    //cin>>test_cnt;
    while(test_cnt--) go();
}
