#pragma GCC optimize "Ofast"
#pragma GCC optimize "unroll-loops"
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define ff first
#define ss second
#define pb push_back

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

    int n;
    cin >> n;
    vector<ll> v(n+1), pref(n+1);
    for (int i=1; i<=n; i++)
        cin >> v[i];
    pref[0] = 0;
    for (int i=1; i<=n; i++) {
        pref[i] = pref[i-1] + v[i];
    }
    ll mn=pref[n], i1=0, i2=0, i3=0, s1, s2, s3;
    for (int i=1; i<=n; i++) {
        for (int j=i+1; j<=n; j++) {
            for (int k=j+1; k<=n; k++) {
                s1 = pref[j-1]-pref[i-1];
                s2 = pref[k-1]-pref[j-1];
                s3 = pref[n]-pref[k-1];
                s3 += pref[i-1];
                if (max({s1, s2, s3}) - min({s1, s2, s3}) < mn) {
                    mn = max({s1, s2, s3}) - min({s1, s2, s3});
                    i1 = i;
                    i2 = j;
                    i3 = k;
                }
            }
        }
    }
    cout << mn << "\n";
    cout << i1 << " " << i2 << " " << i3 << "\n";
}