#include <bits/stdc++.h>
using namespace std;

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

    int n;
    cin>>n;
   int a[n+1], m[n+1];
   m[0]=0;
 
   for (int i = 1; i <= n; i++)
   {
        cin >> a[i];
        m[i] = m[i-1]+a[i];
   }

   int res=1e9, r1, r2, r3;

   for (int i = 1; i <= n; i++)
    {
        for (int j = i+1; j <= n; j++)
        {
            for (int k = j+1; k <= n; k++)
            {
                int s1 = m[j-1]-m[i-1],
                    s2 = m[k-1]-m[j-1];
                int  s3 = m[n]-s1-s2;
                int x = max({s1,s2,s3})-min({s1,s2,s3});
                if (x < res)
                {
                    res = x;
                    r1=i;
                    r2=j;
                    r3=k;
                }
            }
        }
    }

    cout << res << endl << r1 << " " << r2 << " " << r3 << endl;
}
