#include <algorithm>
#include <iostream>
#include <vector>
#include <bits/ranges_algo.h>
#include <algorithm>
#include <climits>
using namespace std;

vector<int> pref_sum;
int Min(vector<int>& v, int i, int j, int z) {
    int s = v.size();


    int i_j = pref_sum[j] - pref_sum[i];

    int j_z = pref_sum[z+1] - pref_sum[j-1];

    int z_i1 = pref_sum[s] - pref_sum[z+1];

    int z_i2 = pref_sum[i];


    int z_i = z_i1 + z_i2;
    vector<int> vec = {i_j, j_z, z_i};
    sort(vec.begin(), vec.end());
    return vec[2] - vec[0];
}

int Min(vector<int>& v, int i, int j) {
    int s = v.size();


    int i_j = pref_sum[j] - pref_sum[i];

    int j_z = pref_sum[s] - pref_sum[j+1];
    int o_i = pref_sum[i];
    vector<int> vec = {i_j, j_z, o_i};
    sort(vec.begin(), vec.end());
    return vec[2] - vec[0];
}

int main() {
    int s;
    cin >> s;
    vector<int> v(s);
    pref_sum.resize(s+1);
    pref_sum[0] = 0;
    for (int i = 0; i < s; i++) {
        cin >> v[i];
        pref_sum[i+1] = pref_sum[i] + v[i];
    }

    // for (int i = 0; i <= s; i++) {
    //     cout<<pref_sum[i]<<" ";
    // }cout<<endl;
    vector<int> result(3);
    int res = INT_MAX;
    for (int i = 0; i < s; i++) {
        for (int j = i + 1; j < s; j++) {
            if (Min(v, i, j) < res) {
                res = Min(v, i, j);
                // cout<<i<<" "<<j<<" "<<res<<endl;
                result[0] = 1;
                result[1] = i+2;
                result[2] = j+2;
            }
            for (int z = j+1; z < s; z++) {
                if (Min(v, i, j, z) < res) {
                    cout<<i<<" "<<j<<" "<<z<<endl;
                    res = Min(v, i, j, z);
                    result[0] = i+1;
                    result[1]=j;
                    result[2] = z+2;

                }
            }
        }
    }

    // for (int i = 1; i <= s; i++) {
    //     for (int j = i+1; j <= s; j++) {
    //         for (int t = j+1; t <= s; t++) {
    //             res = min(res, Min(v, i, j, t));
    //         }
    //     }
    // }

    cout << res << endl;
    cout<<result[0]<<" "<<result[1]<<" "<<result[2]<<endl;

    return 0;
}