// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define all(a) (a).begin(), (a).end()

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

    int n;
    cin >> n;
    vector<ll> a(n);
    // map<ll, ll> occ;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (i != 0) a[i]+=a[i - 1];
        // if (!occ.count(a[i]))
        // occ[a[i]] = i;
    }
    auto cnt = [&](int i, int j, int k) {
        ll mx = max({a[j - 1] - (i == 0 ? 0 : a[i - 1]), a[k - 1] - a[j - 1], a[n - 1] - a[k - 1] + (i == 0 ? 0 : a[i - 1])});
        ll mn = min({a[j - 1] - (i == 0 ? 0 : a[i - 1]), a[k - 1] - a[j - 1], a[n - 1] - a[k - 1] + (i == 0 ? 0 : a[i - 1])});
        return mx - mn;
    };
    ll res = 1e18;
    int ci = 0, cj = 0, ck = 0;
    for (int l = 0; l < n; l++) {
        int p = l;
        for (int r = l; r < n - 2; r++) {
            p = max(p, r + 2);
            while (p < n - 1 && cnt(l, r + 1, p) >= cnt(l, r + 1, p + 1)) p++;
            // cerr << l << ' ' << r << ' ' << p << endl;
            if (cnt(l, r + 1, p) < res) res = cnt(l, r + 1, p), ci = l, cj = r + 1, ck = p;
        }
    }
    cout << res << '\n' << ci + 1 << ' ' << cj + 1 << ' ' << ck + 1 << endl;
}