#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];
void solve(ll x)
{
    ll cur = 0;
    ll m = x+n;
    for (int i=x;i<m-2;i++)
    {
        cur += v[i];
        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[x];
            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 a,b,c;
        a = cur;
        b = p[r2]-p[i];
        c = p[m-1] - p[r2];
        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,(i+1)%n,(r2+1)%n};
        }
    }
}
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;
}
