#include <iostream>
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
#define endl "\n"
//#define vector<ll> vll;
//#define fi first;
//#define se second;
//#define pb push_back;
typedef pair<ll, ll> pll;
const ll dim=1e5+6;
ll n, t;
string s;
ll a[dim];
ll pr[dim], vis[dim];
deque<ll> dq;
ll ans=0;
ll cur=0;


int main()
{
    ll x, y, cnt;
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   // cin>>t;
   t=1;
    while(t--){
        cin>>n;

        ll cur=0;
        ll mx=0;
        ll mn=1e16;
        for(int i=1; i<=n; i++){
            cin>>a[i];
            cur+=a[i];
            pr[i]=pr[i-1]+a[i];
            mx=max(a[i], mx);
            mn=min(a[i], mn);

        }
        if(n==3){
            cout<<mx-mn<<endl;
            cout<<1<<" "<<2<<" "<<3<<endl;
            continue;
        }

        ll l1=0;
        ll r1=pr[n]-1;

        cur=0;
        vector<ll> rs;
        while(r1-l1>=1){
            ll can=0;
            ll dx=(r1+l1)/2;
            ll aim=(pr[n]-dx+2)/3;

            for(int i=1; i<=n; i++){
                ll l=i;
                ll r=n;
                ll st;
                rs.clear();
                while(r-l>=1){
                    ll mid=(l+r+1)/2;
                    if(pr[mid]-pr[i-1]<=aim+dx){
                        l=mid;
                    }
                    else{
                        r=mid-1;
                    }
                }
               // cout<<i<<" "<<r<<endl;
                if(pr[r]-pr[i-1]<=aim+dx){
                    rs.push_back(i);
                    rs.push_back(r+1);
                }
                else{
                    rs.clear();
                    //cout<<endl;
                    continue;
                }
                st=r+1;
                l=st;
                r=n;
                while(r-l>=1){
                    ll mid=(l+r+1)/2;
                    if(pr[mid]-pr[st-1]<=aim+dx){
                        l=mid;
                    }
                    else{
                        r=mid-1;
                    }
                }
                //cout<<st<<" "<<i<<endl<<endl;
                if(pr[r]-pr[st-1]<=aim+dx){
                    if(r+1==n+1){
                        rs.push_back(1);
                    }
                    else rs.push_back(r+1);
                    can=1;
                    break;
                }



            }
            if(can){
                r1=dx;
            }
            else{
                l1=dx+1;
            }

        }
        cout<<r1<<endl;
        for(auto x: rs){
            cout<<x<<" ";
        }



    }


    return 0;
}

