#include <bits/stdc++.h>
using namespace std;
const int maxn = (1e6) + 7;
const int inf = (1e9) + 7;
const long long LLinf = (1e18) + 7;
const long double eps = 1e-9;
const long long mod = 1e9 + 7;
long long t[maxn];
long long suma;
long long pref[maxn], suf[maxn];
long long pre[maxn];
long long pkt[maxn];
long long sum(int l, int p) {
  if (l == 0) return pre[p - 1];
  return pre[p - 1] - pre[l - 1];
}
int odp[3];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
    if (i > 0)
      pre[i] = pre[i - 1] + t[i];
    else
      pre[i] = t[i];
  }
  pre[n] = pre[n - 1];
  for (int i = 0; i < n + 1; i++) pref[i] = suf[i] = -LLinf;
  for (int i = 0; i < n + 1; i++) {
    for (int j = 0; j < i + 1; j++) {
      if (sum(0, j) - sum(j, i) > pref[i]) pkt[i] = j;
      pref[i] = max(pref[i], sum(0, j) - sum(j, i));
    }
  }
  long long res = -LLinf;
  for (int i = n; i > -1; i--) {
    int pk = -1;
    for (int j = i; j < n + 1; j++) {
      if (suf[i] < sum(i, j) - sum(j, n)) pk = j;
      suf[i] = max(suf[i], sum(i, j) - sum(j, n));
    }
    if (res < pref[i] + suf[i]) odp[0] = pkt[i], odp[1] = i, odp[2] = pk;
    res = max(res, pref[i] + suf[i]);
  }
  for (int i = 0; i < 3; i++) cout << odp[i] << " ";
  return 0;
}
