#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define endl '\n'

vector<ll> a, pref;
ll ans = (ll)(1e18);
vector<ll> res = {1, 2, 3};
ll n, s = 0;

ll calc(ll b, ll c, ll d){
    return max({abs(b - c), abs(b - d), abs(c - d)});
}

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

    cin >> n;

    a.resize(n);

    for(auto &i: a)
        cin >> i;

    for(auto i: a)
        s += i;

    for(int i = 0; i < n; i++)
        a.push_back(a[i]);

    pref.resize(2 * n);
    pref[0] = a[0];

    for(int i = 1; i < 2 * n; i++)
        pref[i] = pref[i - 1] + a[i];

    for(int l = 0; l < n; l++){
        ll r2 = l;
        for(int r = l; r < n && (n - (r -  l + 1)) >= 2; r++){
            while(r2 + 1 < n){
                bool ok = (r2 <= r);

                ll s1 = pref[r] - (l != 0 ? pref[l - 1] : 0);
                ll s2 = pref[r2 + 1] - pref[r];
                ll s3 = s - s1 - s2;

                ll can_get = calc(s1, s2, s3);
                if(can_get < ans){
                    ans = can_get;
                    res = {l, r + 1, r2 + 2};
                }

                if(can_get <= ans)
                    ok = true;

                if(ok)
                    r2++;
                else
                    break;
            }

            ll s1 = pref[r] - (l != 0 ? pref[l - 1] : 0);
            ll s2 = pref[r2] - pref[r];
            ll s3 = s - s1 - s2;

            ll can_get = calc(s1, s2, s3);
            if(can_get < ans){
                ans = can_get;
                res = {l, r + 1, r2 + 1};
            }
        }
    }

    cout << ans << endl;
    for(auto i: res)
        cout << i + 1 << ' ';
    cout << endl;

    return 0;
}

/*
1
2
1 2 3
3 4 5

1
5
1 2 1
1 3 4
4 5 2
3 4 2
1 4 3

4
1 2 3
2 3 4
3 5 4
1 3 2

*/
