#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define el '\n'
#define ff first
#define ss second
#define pii pair <ll, ll>
#define pb push_back
#define popb pop_back
#define fr(x, l, r) for(ll (x) = l; (x) <= r; (x)++)
#define frb(x, r, l) for(ll (x) = r; (x) >= l; (x)--)

mt19937_64 rnd(time(0));

ll const N = 1e6 + 100;
ll const INF = 1e18 + 100;

void chmax(ll &a, ll b) {
    a = max(a, b);
}

ll n, ans = INF, s;
ll a[N], pref[N];
vector <ll> res;

void check2(ll a, ll b, ll c) {
    if(a == b || b == c) return;
    ll fir = pref[a - 1] + pref[n] - pref[c - 1];
    ll sec = pref[b - 1] - pref[a - 1];
    ll thr = pref[c - 1] - pref[b - 1];
    ll mx = max({fir, sec, thr});
    ll mn = min({fir, sec, thr});
    if(mx - mn < ans) {
        ans = mx - mn;
        res = {a, b, c};
    }
}

void check(ll l, ll r, ll fir) {
    if(r < l || r > n) return;
    ll bl = l, br = r;
    while(bl < br) {
        ll mid = (bl + br) / 2;
        if(pref[mid] - pref[bl - 1] >= s)
            br = mid;
        else 
            bl = mid + 1;
    }
    check2(l, bl, r + 1);
    check2(l, bl + 1, r + 1);
}

void solve() {
    cin >> n;

    fr(i, 1, n) {
        cin >> a[i];
        pref[i] = pref[i - 1] + a[i];
    }

    s = pref[n] / 3;

    fr(i, 1, n) {
        ll fir = pref[i];
        ll l = i + 1, r = n + 1;
        while(l < r) {
            ll mid = (l + r + 1) / 2;
            if(pref[n] - pref[mid - 1] + fir >= s) l = mid;
            else r = mid - 1;
        }

        check(i + 1, l - 1, fir + pref[n] - pref[l - 1]);
        check(i + 1, l - 2, fir + pref[n] - pref[l - 1]);
        check(i + 1, l, fir + pref[n] - pref[l - 1]);
    }

    cout << ans << el;

    if(res.back() == n + 1) {
        res.pop_back();
        cout << 1 << " ";
    }
    for(ll i : res)
        cout << i << " ";
}

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

    int t = 1;
    //cin >> t;
    while(t--)
        solve();
}