#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 v[n];
    for (int i = 0; i < n; i++) cin >> v[i];
    
    int s1, s2, s3, ans = 1e9, ans_l, x, y, z;
    for (int a = 0; a < n-2; a++) {
        for (int b = a+1; b < n-1; b++) {
            for (int c = b+1; c < n; c++) {
                if (a == 0 && c == n - 1) continue;
                s1 = 0;
                s2 = 0;
                s3 = 0;
                for (int i = a; i < b; i++) s1 += v[i];

                for (int i = b; i < c; i++) s2 += v[i];

                for (int i = c; i < n; i++) s3 += v[i];
                for (int i = 0; i < a; i++) s3 += v[i];

                ans_l = max(max(s1, s2), s3) - min(min(s1, s2), s3);
                if (ans > ans_l) {
                    ans = ans_l;
                    x = a;
                    y = b;
                    z = c;
                }
            }
        }
    }

    cout << ans << "\n" << x+1 << " " << y+1 << " " << z+1 << "\n";
}
