#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<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (i != 0) a[i]+=a[i - 1];
    }
    ll res = 1e18, ci = 0, cj = 0, ck = 0;
    auto process = [&](int i, int j, int k) {
        if (i >= j || j >= k) return;
        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])});
        if (mx - mn < res) {
            res = mx - mn;
            ci = i, cj = j, ck = k;
        }
    };
    for (int l = 0; l < n; l++) {
        for (int r = l + 1; r < n; r++) {
            int ind = lower_bound(a.begin() + l + 1, a.begin() + r + 1, (l == 0 ? 0 : a[l - 1]) + (a[r] - (l == 0 ? 0 : a[l - 1])) / 2) - a.begin();
            if (ind < n) process(l, ind, r);
            if (ind > 0) process(l, ind - 1, r);
            if (ind < n - 1) process(l, ind + 1, r);
        }
    }
    cout << res << '\n' << ci + 1 << ' ' << cj + 1 << ' ' << ck + 1 << endl;
}