#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 ++) {
        for (int j = i + 1; j < n; j ++) {
            int l = 1;
            int r = (n - j + i);
            auto check = [&](int k) {
                ll _x = p[j] - p[i];
                ll _y = p[j + k] - p[j];
                ll _z = p[j + r] - 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;
                }
                return _y <= _z;
            };
            if (r - l <= 2) {
                for (int k = l; k < r; k ++) check(k);
            }
            while (l + 1 < r) {
                int mid = (l + r) / 2;
                if (check(mid)) l = mid;
                else r = mid;
                if (_r == 0) goto EXITE;
            }
            /*if (l + 1 < (n - j + i)) {
                check(l + 1);
            }*/
        }
    }
    EXITE:
    cout << _r << "\n" << _a << " " << _b << " " << _c % n + 1 << endl;
}
