#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define all(x) x.begin(), x.end()
#define fastread ios_base::sync_with_stdio(0);cin.tie(NULL)
#define sum(x) accumulate(all(x),0LL)
#define what_is(x) cerr << #x << " = " << (x) << '\n'
#define pb push_back

int main()
{
    fastread;
    int n;
    cin >> n;
    ll v[10005] = {0},pref[10005] = {0},s = 0;
    for(int i = 1; i <= n; i++) {
        cin >> v[i];
        pref[i] = pref[i-1] + v[i];
        s += v[i];
    }
    int ind1 = 1,ind2 = 1,ind3 = 1;
    while (pref[ind2] - pref[ind1-1] != s / 3) {
        if (pref[ind2] - pref[ind1-1] > s / 3) {
            ind1++;
        }
        else {
            ind2++;
        }
    }
    ind2++;
    ll ss = 0;
    for (int i=ind2;i<=n;++i) {
        ss += v[i];
        if (ss == s/ 3) {
            ind3 = i;
            break;
        }
    }
    ind3++;
    cout << ind1 << ' ' << ind2 << ' ' << ind3 << '\n';
    return 0;
}

