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

typedef long long ll;
const ll DIM = 1e6+7;
const ll INF = 1e9+7;
ll n, a[DIM], s,p1,p2,p3,s1,s2,s3,ans,x,y,z;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++) {
        cin>>a[i];
        s+=a[i];
    }
    ans = INF;
    p1=1; p2=2; p3=3;
    s1 = a[1]; s2= a[2]; s3=s-s1-s2;
    while(p3!=n+1) {
        if(max(s1,max(s2, s3)) - min(s1, min(s2, s3)) < ans) {
           x=p1; y=p2; z=p3;
           ans = max(s1,max(s2, s3)) - min(s1, min(s2, s3));
        }

        if(s1>s2 && s1>s3) {
            s1-=a[p1];
            s3+=a[p1];
            p1++;

        }
        else if(s2>s1 && s2>s3) {
            s2-=a[p2];
            s1+=a[p2];
            p2++;
        }
        else {
            s3-=a[p3];
            s2+=a[p3];
            p3++;
        }

    }

    cout<<ans<<endl;
    cout<<x<<" "<<y<<" "<<z;
}

