#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define str string
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int) a.size()
#define fi first
#define se second
// using namespace __gnu_pbds;
// #define o_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
using namespace std;

mt19937 rng(474);

int getnum(int l,int r){
    uniform_int_distribution<int> dist(l,r);
    return dist(rng);
}

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

    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> pref(n+1);
    pref[0] = 0;
    for(int i = 0;i<n;++i){
        cin >> a[i];
        pref[i+1] = pref[i] + a[i];
    }
    int ans = 1e18;
    int x,y,zz;
    for(int i = 0;i<n;++i){
        for(int j = i+1;j<n;++j){
            for(int z = j+1;z <n;++z){
                int k1 = pref[j] - pref[i], k3 = pref[i] + pref[n]-pref[z], k2 = pref[z]-pref[j];
                if(max(max(abs(k1-k2),abs(k2-k3)),abs(k1-k3)) < ans){
                    ans = min(ans,max(max(abs(k1-k2),abs(k2-k3)),abs(k1-k3)));
                    x = i+1,y = j+1, zz = z+1;
                }
            }
        }
    }
    cout << ans << '\n';
    cout << x << " " << y << " " << zz << '\n';
}