#include <iostream>
#include <vector>
#include <algorithm>
#include <limits>

using namespace std;
using ll = long long;

const ll inf = numeric_limits<ll>::max() / 2;

int main() {
#ifndef DEBUG
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif

    int n;
    cin >> n;

    vector<ll> arr(n);

    for (auto& it : arr) {
        cin >> it;
    }

    vector<ll> pref_sums(n + 1);
    pref_sums[0] = 0;

    for (int i = 0; i < n; i++) {
        pref_sums[i + 1] = pref_sums[i] + arr[i];
    }

    auto get_sum = [&](int l, int r) {
        l = l % n;
        r = r % n;

        if (r < l) {
            return pref_sums[n] - (pref_sums[l] - pref_sums[r]);
        }

        return pref_sums[r] - pref_sums[l];
    };

    auto get_diff = [&](ll a, ll b, ll c) {
        return max({ a, b, c }) - min({ a, b, c });
    };

    ll res = inf;
    int best_i = 0;
    int best_j = 0;
    int best_k = 0;

    for (int i = 0; i < n; i++) {
        int k = i + 2;

        for (int j = i + 1; j < i + n - 1; j++) {
            k = max(k, j + 1);
            ll sum1 = get_sum(i, j);

            while (k < i + n) {
                ll sum2 = get_sum(j, k);

                if (sum2 > sum1) {
                    break;
                }

                k++;
            }

            k = max(j + 1, k - 1);

            ll curr = get_diff(
                get_sum(i, j),
                get_sum(j, k),
                get_sum(k, i)
            );

            if (curr < res) {
                res = curr;
                best_i = i;
                best_j = j;
                best_k = k;
            }

            if (k + 1 < i + n) {
                ll curr = get_diff(
                    get_sum(i, j),
                    get_sum(j, k + 1),
                    get_sum(k + 1, i)
                );

                if (curr < res) {
                    res = curr;
                    best_i = i;
                    best_j = j;
                    best_k = k + 1;
                }
            }
        }
    }

    cout << res << "\n";

    vector<int> bounds = { best_i % n, best_j % n, best_k % n };
    sort(bounds.begin(), bounds.end());

    for (int bound : bounds) {
        cout << bound + 1 << " ";
    }

    cout << "\n";

    return 0;
}
