#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7;
const int MOD = 1e9 + 7;
const int K = 11;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umod(T& a) {
  while (a < 0) a += MOD;
  a %= MOD;
  return 1;
}
int n;
long long arr[N], ps[N], ans = -1LL * MOD * MOD;
int d[3];
pair<long long, int> l[N], r[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", arr + i);
  for (int i = 1; i <= n + 1; i++) {
    ps[i] = ps[i - 1] + arr[i];
    l[i] = {-1LL * MOD * MOD, -1};
    r[i] = {-1LL * MOD * MOD, -1};
  }
  for (int i = 1; i <= n + 1; i++) {
    for (int j = 1; j <= i; j++)
      if (ps[j - 1] - (ps[i - 1] - ps[j - 1]) >= l[i].first)
        l[i] = {ps[j - 1] - (ps[i - 1] - ps[j - 1]), j};
  }
  for (int i = 1; i <= n + 1; i++) {
    for (int j = i - 1; j <= n; j++)
      if ((ps[j] - ps[i - 1]) - (ps[n] - ps[j]) >= r[i].first)
        r[i] = {(ps[j] - ps[i - 1]) - (ps[n] - ps[j]), j + 1};
  }
  for (int i = 1; i <= n + 1; i++)
    if (umax(ans, l[i].first + r[i].first))
      d[0] = l[i].second, d[1] = i, d[2] = r[i].second;
  for (int i = 0; i < 3; i++) printf("%d ", d[i] - 1);
  puts("");
  return 0;
}
