#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
using ll = long long;



struct DSU {
    int n;
    vector<int> p, h;

    DSU(int m) {
        n = m;
        p.assign(n + 1, -1);
        h.assign(n + 1, 1);

        for (int i = 0; i <= n; i++) {
            p[i] = i;
            h[i] = 1;
        }
    }

    int findParent(int node) {
        if (p[node] == node) {
            return node;
        }
        return p[node] = findParent(p[node]);
    }

    bool sameSet(int a, int b) {
        a = findParent(a);
        b = findParent(b);
        return a == b;
    }

    void unionSets(int a, int b) {
        a = findParent(a);
        b = findParent(b);
        if (a == b) return;
        if (h[a] < h[b]) {
            swap(a, b);
        }
        p[b] = a;
        h[a] += h[b];
    }
};

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

    int n;
    cin >> n;

    ll a[n + 1] = {};
    ll pref[n + 1] = {};
    for (int i = 0; i < n; i++) {
        cin >> a[i + 1];
        pref[i + 1] = pref[i] + a[i + 1];
    }

    int aa, b, c;
    ll ans = LLONG_MAX;

    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 one = pref[j - 1] - pref[i - 1];
                ll two = pref[k - 1] - pref[j - 1];
                ll three = pref[n] - pref[k - 1] + pref[i - 1];

                ll here = max({one, two, three}) - min({one, two, three});
                if (here < ans) {
                    ans = here;
                    aa = i; b = j; c = k;
                }
            }
        }
    }

    printf("%lld\n", ans);
    printf("%i %i %i\n", aa, b, c);


    
    
}