#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 (int i = 0; i < n; ++i)
        cin >> a[i];

    vector <long long> ps(n + 1, 0);
    for (int i = 0; i < n; ++i)
        ps[i + 1] = ps[i] + a[i];
    
    int x, y, z;
    long long best = 9223372036854775807;
    for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j)
            for (int k = j + 1; k < n; ++k)
            {
                long long s1 = ps[j] - ps[i];
                long long s2 = ps[k] - ps[j];
                long long s3 = ps[n] - (s1 + s2);

                long long mn = min({s1, s2, s3});
                long long mx = max({s1, s2, s3});

                if (mx - mn < best)
                {
                    best = mx - mn;
                    x = i;
                    y = j;
                    z = k;
                }
            }
    //int x = 0, z = n - 1, y = (n / 2);
    cout << best << endl;
    cout << x + 1 << ' ' << y + 1 << ' ' << z + 1 << endl;

    return 0;
}
