#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define el '\n'
#define ff first
#define ss second
#define pii pair <ll, ll>
#define pb push_back
#define popb pop_back
#define fr(x, l, r) for(ll (x) = l; (x) <= r; (x)++)
#define frb(x, r, l) for(ll (x) = r; (x) >= l; (x)--)

mt19937_64 rnd(time(0));

ll const N = 1e6 + 100;
ll const INF = 1e18 + 100;

void chmax(ll &a, ll b) {
    a = max(a, b);
}

ll n, ans = INF;
ll a[N], pref[N];
vector <ll> res;

void solve() {
    cin >> n;

    fr(i, 1, n) {
        cin >> a[i];
        pref[i] = pref[i - 1] + a[i];
    }

    fr(a, 1, n) {
        fr(b, a + 1, n) {
            fr(c, b + 1, n) {
                ll fir = pref[n] - pref[c - 1] + pref[a - 1];
                ll sec = pref[b - 1] - pref[a - 1];
                ll thr = pref[c - 1] - pref[b - 1];
                ll mx = max({fir, sec, thr});
                ll mn = min({fir, sec, thr});
                if(mx - mn < ans) {
                    ans = mx - mn;
                    res = {a, b, c};
                }
           }
        }
    }
    cout << ans << el;
    for(ll i : res)
        cout << i << " ";
}

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

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