#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n;
vector<ll> v;
ll res = 1e18;
vector<ll> res2;
ll p[2000007];
vector<ll> calc(ll i, ll m)
{
    ll l = i+1, r = m-2;
    ll r1 = 1e18,r2;
    while (l<=r)
    {
        ll mid = (l+r)/2;
        ll a;
        a = p[mid]-p[i];
        ll b;
        b = p[m-1] - p[mid];
        if (abs(a-b)<r1)
        {
            r1 = abs(a-b);
            r2 = mid;
        }
        if (a<b)
        {
            l = mid+1;
        }
        else if (a>b)
        {
            r = mid-1;
        }
        else
        {
            break;
        }
    }
    ll b,c;
    b = p[r2]-p[i];
    c = p[m-1] - p[r2];
    return {b,c,r2};
}
void solve(ll x)
{
    ll m = n+x;
    ll l = x, r = m-3;
    while (l<=r)
    {
        ll mid = (l+r)/2;
        ll a;
        if (x!=0) a = p[mid]-p[x-1];
        else a = p[mid];
        vector<ll> k = calc(mid,m);
        ll b = k[0];
        ll c = k[1];
        ll d = k[2];
        if ((max(a,max(b,c))-min(a,min(b,c)))<res)
        {
            res = (max(a,max(b,c))-min(a,min(b,c)));
            res2 = {x%n,(mid+1)%n,(d+1)%n};
        }
        if (a>max(b,c))
        {
            r = mid-1;
        }
        else if (a<max(b,c)) l = mid+1;
        else break;
    }
}
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >>n;
    v.resize(n);
    res2.resize(3);
    for(int i=0;i<n;i++)
    {
        cin >>v[i];
        v.push_back(v[i]);
    }
    ll cur = 0;
    for (int i=0;i<2*n;i++)
    {
        cur += v[i];
        p[i] = cur;
    }
    for (int i=0;i<n;i++)
    {
        solve(i);
    }
    sort(res2.begin(),res2.end());
    cout <<res<<endl;
    cout <<res2[0]+1<<" "<<res2[1]+1<<" "<<res2[2]+1;
}
