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

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

    int n; cin>>n; int a[2*n+1]; for (int i=1; i<=n; i++) cin>>a[i];
    for (int i=n+1; i<=2*n; i++) a[i] = a[i-n];

    long long s=0;
    for (int i=1; i<=n; i++) s+=a[i];
    long long pref[2*n+1]; pref[0]=0;
    for (int i=1; i<=2*n; i++) pref[i] = pref[i-1]+a[i];

    long long ans=1e9, ans1, ans2, ans3;;

    for (int i=1; i<=n; i++)
        for (int j=i+1; j<=n; j++) {
            long long s1 = pref[j]-pref[i];
            for (int k=j+1; k<=n; k++) {
                long long s2 = pref[k]-pref[j];
                long long s3 = s-s1-s2;
                long long ansc = max(abs(s1-s2), abs(s2-s3));
                ansc = max(ansc, abs(s1-s3));
                if (ansc<ans) {
                    ans = ansc;
                    ans1 = i; ans2=j; ans3=k;
                }
            }
        }


    cout<<ans<<"\n";
    if (ans3==n) {
        cout<<1<<' '<<ans1+1<<' '<<ans2+1;
    }
    else cout<<ans1+1<<' '<<ans2+1<<' '<<ans3+1;

}
