#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair < ll, ll > pii;
typedef pair < ld, ld > pdd;

const ll DIM = 1500007;
const ll INF = 1e18;
const ld eps = 0.00000001;
const ld gr = (1 + sqrt(5)) / 2;

ll n, sum;
ll x[DIM];

ll calc(ll a, ll b, ll c) {
    vector < ll > v;
    v.push_back(a);
    v.push_back(b);
    v.push_back(c);

    sort(v.begin(), v.end());
    return v.back() - v[0];
}

pair < ll, pii > solve() {
    ll val = 0;
    ll res = INF;
    pii p;
    for(int i = n; i >= 3; i--) {
        val += x[i];

        ll v2 = 0;
        for(int j = 1; j < i; j++) {
            v2 += x[j];
            if(calc(val, v2, sum - val - v2) < res) {
                res = calc(val, v2, sum - val - v2);
                p = {j, i};
            }
        }
    }
    return {res, p};
}

int main()
{
    deque < ll > a;

    cin >> n;
    for(int i = 1; i <= n; i++) {
        ll x;
        cin >> x;
        sum += x;
        a.push_back(x);
    }

    pair < ll, pii > p;

    ll ans = INF;
    for(int i = 0; i <= n - 1; i++) {

        for(int j = 1; j <= n; j++) x[j] = a[j - 1];
        pair < ll, pii > so = solve();
        if(so.first < ans) {
            ans = so.first;
            p.first = 1 + i;
            p.second.first = so.second.first + i;
            p.second.second = so.second.second + i;
        }

                ll val = a.front();
        a.push_back(val);
        a.pop_back();
    }
    cout << ans << endl;
    cout << p.first << " " << p.second.first << " " << p.second.second << endl;

    return 0;
}
