#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;
    vector<int> a(n);
    for(auto& u:a){
        cin>>u;
    }
    int mini=INT_MAX;
    vector<int> pref(n+1,0);
    for(int i=1;i<=n;i++){
        pref[i]=pref[i-1]+a[i-1];
    }
    int t1,t2,t3;
    // for(auto u:pref){cout<<u<<" ";}
    // cout<<endl;
    for(int i=1;i<=n-2;i++){
        for(int j=i+1;j<=n-1;j++){
            for(int k=j+1;k<=n;k++){
                int s1=pref[j-1]-pref[i-1],s2=pref[k-1]-pref[j-1];
                int s3=pref[n]-s1-s2;
                if(mini>max({s1,s2,s3})-min({s1,s2,s3})){
                    mini = max({s1,s2,s3})-min({s1,s2,s3});
                    t1=i;t2=j;t3=k;
                }

            }
        }
    }
    cout<<mini<<endl<<t1<<" "<<t2<<" "<<t3;
}
