#include <bits/stdc++.h>
using namespace std;
const long long DIM = 1e6+7;
long long a[DIM], p[DIM];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long n;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> a[i];
        p[i] = p[i-1] + a[i];
    }
    pair<long long, pair<long long, long long>> ans;
    long long ma = 1e18+7;
    for(int i=1; i<=n-2; i++){
        for(int j=i+1; j<=n-1; j++){
            for(int k=j; k<=n; k++){
                long long sum1 = p[j-1] - p[i-1];
                long long sum2 = p[k-1] - p[j-1];
                long long sum3 = p[n] - p[k-1] + p[i-1];

                long long mx = max(sum1, max(sum2, sum3));
                long long mn = min(sum1, min(sum2, sum3));

                if(mx - mn < ma){
                    ma = mx-mn;
                    ans = {i, {j, k}};
                }
            }
        }
    }

    cout << ma << endl;
    cout << ans.first << " " << ans.second.first << " " << ans.second.second << endl;
} 
