#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;
    int sum = 0;
    for(int i = 0;i<n;++i){
        cin >> a[i];
        sum += a[i];
        pref[i+1] = pref[i] + a[i];
    }
    int ans = 1e18;
    int x1,y1,z1;
    for(int i = 0;i<n;++i){
        int j = i;
        int x = i,y,z;
        int s1 = 0;
        while(s1*3<sum){
            s1+=a[j];
            j++;
            j%=n;
        }
        y = j;
        int s2 = 0;
        while(s2*3 < sum){
            s2 += a[j];
            j++;
            j%=n;
        }
        z= j;
        int s3 = sum-s1-s2;
        if(x != y && x != z && y!= z){
            if(max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3)) < ans){
                ans = min(ans,max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3)));
                x1 = x,y1 = y,z1= z;
            }
        }
        y--;
        if(y == -1) y = n-1;
        s1 -= a[y];
        s2 += a[y];
        if(x != y && x != z && y!= z){
            if(max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3)) < ans){
                ans = min(ans,max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3)));
                x1 = x,y1 = y,z1= z;
            }
        }
        z--;
        if(z == -1) z= n-1;
        s2 -= a[z];
        s3 += a[z];
        if(x != y && x != z && y!= z){
            if(max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3)) < ans){
                ans = min(ans,max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3)));
                x1 = x,y1 = y,z1= z;
            }
        }
        y++;
        if(y == n) y = 0;
        s1 += a[y];
        s2 -= a[y];
        if(x != y && x != z && y!= z){
            if(max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3)) < ans){
                ans = min(ans,max(max(abs(s1-s2),abs(s2-s3)),abs(s1-s3)));
                x1 = x,y1 = y,z1= z;
            }
        }
    }
    cout <<ans<<'\n';
    vector<int> cc = {x1+1,y1+1,z1+1};
    sort(all(cc));
    cout << cc[0] << " " << cc[1] << " " << cc[2];
}