#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[n+1];
    long long pref[n+1];
    for (int i = 1; i<= n; i++){
        cin >> a[i];
    }

    

    pref[0] = 0;
    for (int i = 1 ; i <= n; i++){
        pref[i] = a[i] + pref[i-1];
    }
    /*for (const auto& t : pref )
        cout << t << " ";
    cout << endl;*/
    int roz = 1e10 + 9;
    int res[3];
    for (int x = 1; x * x <= n + 1; x++){
        for (int y = x+1; y <= n-1; y++){
            for (int z = y+1; z <= n; z++){
                long long sum1, sum2, sum3;
                sum1 = pref[y-1] - pref[x-1];
                sum2 = pref[z-1] - pref[y-1];
                sum3 = pref[n] - pref[z-1] + pref[x-1];
                //cout << sum1 << " " << sum2 << " " << sum3 << endl;
                long long rizn = max(sum1, max(sum2, sum3)) - min(sum1, min(sum2, sum3));

                if ( rizn < roz){
                    roz = rizn;
                    res[0] = x;
                    res[1] = y;
                    res[2] = z;
                    //cout << sum1 << " " << sum2 << " " << sum3 << endl;
                }
                if(roz == 0){
                    cout << 0 << endl;
                    cout << res[0] << " " << res[1] << " " << res[2];
                    return 0;
                }
            }
        }
    }

    cout << roz << endl;
    for (int i = 0; i < 3; i++){
        cout << res[i] << " ";
    }

}
