#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long
#define vll vector<ll>
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define fr first
#define se second
#define pb push_back
#define vvll vector<vll>
#define pll pair<ll, ll>
#define vbool vector<bool>
#define INF 1000000000000000007
#define endl "\n"
#define sort(a) sort(a.begin(), a.end())

using namespace std;
using namespace __gnu_pbds;

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

    ll n;
    cin >> n;
    vll a(n);
    ll sum = 0;
    for (int i = 0; i < n; i ++) {
        cin >> a[i];
        sum += a[i];
    }
    ll minl = INF, x, y, z;
    for (int i = 0; i < n; i ++) {
        for (int j = i+1; j < n; j ++) {

            for (int i1 = j+1; i1 < n; i1++) {
                ll s = 0;
                for (int i2 = i; i2 < j; i2 ++) {
                    s += a[i2];
                }
                ll s1 = 0;
                for (int i2 = j; i2 < i1; i2 ++) {
                    s1 += a[i2];
                }
                if (max({s, s1, sum-(s1+s)})-min({s, s1, sum-(s1+s)}) < minl) {
                    minl = max({s, s1, sum-(s1+s)})-min({s, s1, sum-(s1+s)});
                    x = i+1;
                    y = j+1;
                    z = i1+1;
                    if (z == n+1) z = 1;
                }
            }
        }
    }

    cout << minl << endl;
    vll res{x, y, z};
    sort(res);
    cout << res[0] << ' ' << res[1] << ' ' << res[2] << endl;
}