#include <bits/stdc++.h>

using namespace std;

#define print(a) cerr << "[" << #a << " = " << a << "] "
#define dbg(a) print(a) << "\n"
#define dbg2(a, b) print(a); print(b) << "\n"
#define dbg3(a, b, c) print(a); print(b); print(c) << "\n"

#define int long long
#define ll long long
#define pi pair<int, int>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(a) ((int)(a).size())
#define divup(a, b) (((a) + (b) - 1) / (b))

template <class T> bool chmax(T&a, const T&b) {return b > a ? a = b, 1 : 0;};
template <class T> bool chmin(T&a, const T&b) {return b < a ? a = b, 1 : 0;};

const int mod = 1e9 + 7;
const int inf = (int)(1e18) + 7;

const int maxn = 2e5 + 7;
const int N = 1e4 + 7;
const int logn = 20;

void solve() {
    int n;
    cin >> n;
    vector <int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    int ans = inf;
    vector <int> res;
    for (int i = 0; i < n; ++i) {
        vector <int> b; 
        for (int j = i; j < n; ++j) {
            b.push_back(a[j]);
        }
        for (int j = 0; j < i; ++j) {
            b.push_back(a[j]);
        }
        vector <int> p(n, 0);
        for (int i = 0; i < n; ++i) {
            if (i) p[i] = p[i - 1] + a[i];
            else p[i] = a[i]; 
        }
        vector <int> t;
        int sum = p[n], cur = inf;
        for (int j = 1; j + 1 < n; ++j) {
            for (int k = j + 1; k < n; ++k) {
                int t1 = p[j - 1];
                int t2 = p[k - 1] - t1;
                int t3 = p[n] - t2;
                int mn = min({t1, t2, t3});
                int mx = max({t1, t2, t3});
                if (mx - mn < cur) {
                    cur = mx - mn;
                    t = {0, j, k};
                }
            }
        }
        if (cur < ans) {
            ans = cur;
            res.clear();
            for (auto j : t) {
                res.push_back((j + i) % n + 1);
            }
        }
    }
    sort(all(res));
    cout << ans << "\n";
    for (auto i : res) cout << i << " ";
}

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

    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);

    solve();
} 