#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;
    long long a[n + 5];
    a[0] = 0;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        a[i] += a[i - 1];
    }
    long long ans = 1e18, a1, a2, a3, k1, k2, k3, mn, mx, cur;
    for (int x = 1; x <= n; x++)
    {
        for (int y = x + 1; y <= n; y++)
        {
            for (int z = y + 1; z <= n; z++)
            {
                k1 = a[y - 1] - a[x - 1];
                k2 = a[z - 1] - a[y - 1];
                k3 = a[x - 1] + a[n] - a[z - 1];
                mn = min(k1, min(k2, k3));
                mx = max(k1, max(k2, k3));
                cur = mx - mn;
                if (cur < ans)
                {
                    ans = cur;
                    a1 = x;
                    a2 = y;
                    a3 = z;
                }
            }
        }
    }
    cout << ans << "\n" << a1 << " " << a2 << " " << a3;
}

