#include <bits/stdc++.h>

#define ll long long

using namespace std;
vector<ll> g, pref;
ll n;

ll D(ll l, ll r){
    return pref[r] - pref[l - 1]; 
}

ll solve(ll x, ll y, ll z){
    ll a = D(x, y - 1);
    ll b = D(y, z - 1);
    ll c = D(1, x - 1) + D(z, n);
    return max(a, max(b, c)) - min(a, min(b, c));
}
ll uwu(ll x, ll y){
    ll h = D(x, y - 1);
    ll l = y + 1, r = n;
    ll ZZ = pref[x - 1] + pref[n];
    while(l < r - 1){
        ll m1 = l + (r - l  + 2) / 3;
        ll m2 = r - (r - l + 2) / 3;
        ll YY1 = D(y, m1 - 1), ZZ1 = ZZ - pref[m1 - 1];
        ll YY2 = D(y, m2 - 1), ZZ2 = ZZ - pref[m2 - 1];
        if(abs(YY1 - ZZ1) > abs(YY2 - ZZ2)){
            l = m1 + 1;
        }else
        if(abs(YY1 - ZZ1) < abs(YY2 - ZZ2)){
            r = m2 - 1;
        }else{
            l = m1;
        }
    }
    if(solve(x, y, l) > solve(x, y, r)) return r;
    return l;
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    g.resize(n + 1, 0);
    pref.resize(n + 1, 0);
    for(ll i = 1; i <= n; i++){
        cin >> g[i];
        pref[i] = pref[i - 1] + g[i];
    }
    ll x = 1, y = 2, z = 3;ll ans = solve(x, y, z);
    ll a = 1;
    ll b = 2;
    for(ll i = 2; i < n; i++){
        ll c = uwu(a, i);
        ll k = solve(a, i, c);
        if(k < ans){
            x = a;
            y = i;
            z = c;
            b = i;
            ans = k;
        }
    }
    a++;
    for(; a < n - 1;a++){
        if(a == b)b++;
        while(solve(a, b + 1, uwu(a, b + 1)) < solve(a, b, uwu(a, b)))b++;
        ll e = uwu(a, b);
        ll k = solve(a, b, e);
        if(b > n - 1 || e > n)break;
        if(k < ans){
            x = a;
            y = b;
            z = e;
            ans = k; 
        }
    }
    cout << ans << endl;
    cout << x << " " << y << " " << z << endl;
}

