#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;
const int N = 2e6+7;
int INF = 1e18+7;
int ans = INF;
vector<int> a(N), pref(N);
mt19937 rng(474);

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

int get3(int m1,int i,int j){
    if(!(j>i && m1 > j && i+n > m1)) return INF;
    // cout << i << " " << j << " " << m1 << '\n';
    int s1,s2,s3;
    s1 = pref[j] - pref[i], s2 = pref[m1] - pref[j],  s3 = pref[i+n] - pref[m1];
    // if(i == 2 && j == 3 && m1 == 6) cout << max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3)) << '\n';
    if(max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3)) < ans){
        ans = max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3));
        aa = i%n+1, ba= j%n+1,ca = m1%n+1;
        vector<int> cc = {aa,ba,ca};
        sort(all(cc));
        aa = cc[0], ba = cc[1], ca = cc[2];
    }
    return max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3));
}

int get2(int l,int r,int i,int j){
    while(l + 2 < r){
        int m1 = l + (r-l)/3;
        int m2 = r - (r-l)/3;
        if(get3(m1,i,j) < get3(m2,i,j)){
            r = m2;
        }else{
            l = m1;
        }
    }
    int res = INF;
    for(int z = l;z<=r;++z){
        res = min(res,get3(z,i,j));
    }
    return res;
}

int get1(int l,int r,int i){
    while(l + 2 < r){
        int m1 = l + (r-l)/3;
        int m2 = r- (r-l)/3;
        if(get2(m1+1,i+n-1,i,m1) < get2(m2+1,i+n-1,i,m2)){
            r = m2;
        }else{
            l = m1;
        }
    }
    int res = INF;
    for(int j = l;j<=r;++j){
        res = min(res,get2(j+1,i+n,i,j));
    }
    return res;
}

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

    cin >> n;
    pref[0] = 0;
    int sum = 0;
    for(int i = 1;i<=n;++i){
        cin >> a[i];
        sum += a[i];
        pref[i] = pref[i-1] + a[i];
    }
    for(int i = n+1;i<=2*n;++i){
        a[i] = a[i-n];
        pref[i] = pref[i-1] + a[i];
    }
    int x1,y1,z1;
    int l = 1, r = n;
    while(l+2 < r){
        int m1 = l + (r-l)/3;
        int m2 = r - (r-l)/3;
        if(get1(m1+1,m1+n-1,m1) < get1(m2+1,m2+n-1,m2)){
            r = m2;
        }else{
            l = m1;
        }
    }
    // cout << l << " " << r << '\n';
    for(int j = l;j<=r;++j){
        ans = min(ans,get1(j+1,j+n,j));
    }
    cout << ans << '\n';
    cout << aa << " "<< ba << " "<< ca;
}