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

#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define all(x) x.begin(), x.end()
#define fastread ios_base::sync_with_stdio(0);cin.tie(NULL)
#define sum(x) accumulate(all(x),0LL)
#define what_is(x) cerr << #x << " = " << (x) << '\n'
#define pb push_back

int main()
{
    fastread;
    int n;
    cin >> n;
    ll v[1000005] = {0},pref[1000005] = {0},s = 0;
    for(int i = 1; i <= n; i++) {
        cin >> v[i];
        pref[i] = pref[i-1] + v[i];
        s += v[i];
    }
    pair<int,pair<int,pii> > ans = {INT_MAX,{0,{0,0}}};
    for (int i=1;i<=n-2;++i) {
        for (int j=i+1;j<=n-1;++j) {
            for (int k=j+1;k<=n;++k) {
                ll s1 = pref[j-1] - pref[i - 1];
                ll s2 = pref[k-1] - pref[j - 1];
                ll s3 = pref[n] - pref[k - 1] + pref[i - 1];
                if(max({s1,s2,s3}) - min({s1,s2,s3}) < ans.first)
                {
                    ans.first = max({s1,s2,s3}) - min({s1,s2,s3});
                    ans.second = {i,{j,k}};
                }
            }
        }
    }
    cout << ans.first << "\n" << ans.second.first << " " << ans.second.second.first << " " << ans.second.second.second;
    return 0;
}

