#include <bits/stdc++.h>
using namespace std;

#define int long long
#define mp make_pair

const int mxN = 1e6 + 1;
int t, n, a[mxN];

int32_t main() {
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        
                cin >> n;
                for(int i = 1; i <= n; ++i) cin >> a[i];
                vector<int> pref(n + 1, 0);
                for(int i = 1; i <= n; ++i) {
                        pref[i] = pref[i-1] + a[i];
                }
                int res = 1e18, l, r, dk;
                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++) {
                                        set<int> s;
                                        s.insert(pref[i-1] + pref[n] - pref[k - 1]);
                                        s.insert(pref[j-1] - pref[i-1]);
                                        s.insert(pref[k-1] - pref[j-1]);
                                        if(res > *s.rbegin() - *s.begin()) {
                                                res = *s.rbegin() - *s.begin();
                                                l = i;
                                                r = j;
                                                dk = k;
                                        }
                                }
                        }
                }
                cout << res << endl;
                cout << l << " " << r << " " << dk << endl;
}
