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

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

    int n;
    cin>>n;
    vector<ll> a(n);
    ll sma = 0;
    for (auto& el : a) {
        cin>>el;
        sma += el;
    }
    int a1 = -1;
    int b = -1;
    int c = -1;
    ll res = 1e18;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            for (int k = 0; k < n; k++) {
                if (i == j || i == k || j == k) {
                    continue;
                }
                ll sm1 = 0;
                ll sm2 = 0;
                ll sm3 = 0;
                int ind = i;
                while (ind != j) {
                    sm1 += a[ind];
                    ind += 1;
                    ind %= n;
                }
                while (ind != k) {
                    sm2 += a[ind];
                    ind += 1;
                    ind %= n;
                }
                sm3 = sma - sm1 - sm2;
                ll ca = max(max(sm1, sm2), sm3) - min(min(sm1, sm2), sm3);
                if (ca < res) {
                    res = ca;
                    a1 = i;
                    b = j;
                    c = k;
                }
            }
        }
    }
    cout << res << endl;
    cout << a1 + 1 << " " << b + 1 << " " << c + 1 << endl;
}
