#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;
    vector<int> a(n);
    for (auto &i : a) cin >> i;
    vector<ll> p(n + n + 1);
    for (int i = 0; i < (int)p.size() - 1; i ++) {
        p[i + 1] = p[i] + a[i % n];
    }
    long long _r = LLONG_MAX / 2;
    int _a, _b, _c;
    for (int i = 0; i < n; i ++) {
        auto cjek = [&](int j) {
            int l = 1;
            int r = (n - j + i);
            int rc = r;
            auto check = [&](int k) {
                ll _x = p[j] - p[i];
                ll _y = p[j + k] - p[j];
                ll _z = p[j + rc] - p[j + k];
                ll _t = max({_x, _y, _z}) - min({_x, _y, _z});
                if (_t < _r) {
                    _r = _t;
                    _a = i + 1;
                    _b = j + 1;
                    _c = (j + k) % n + 1;
                }
                return _y < _z;
            };
            while (l + 1 < r) {
                int mid = (l + r) / 2;
                if (check(mid)) l = mid;
                else r = mid;
            }
            check(l);
            //if (l + 1 < rc) check(l + 1);
            //if (l - 1 >= 1) check(l - 1);
            //if (_r == 0) goto OUT;
            //cout << (p[j + l] - p[j] > p[j] - p[i]) << " ";
            return p[j + l] - p[j] > p[j] - p[i];
        };
        int lo = i + 1;
        int ro = n;
        while (lo + 1 < ro) {
            int mid  =(lo + ro) / 2;
            if (cjek(mid)) lo = mid;
            else ro = mid;
        }
        if (lo < ro) cjek(lo);
    }
    OUT:
    cout << _r << "\n" << _a << " " << _b << " " << _c << endl;
}
