#include <bits/stdc++.h>
using namespace std;
inline int rd() {
  int first = 0, c = 0, f = 1;
  for (; c < '0' || c > '9'; c = getchar()) f = c != '-';
  for (; c >= '0' && c <= '9'; c = getchar()) first = first * 10 + c - '0';
  return f ? first : -first;
}
const int N = 5011;
long long a[N];
int n;
pair<long long, int> calc(int l, int r) {
  long long ret = 0;
  int pos = 0;
  for (int i = (l - 1), i_end = (r); i <= i_end; i++) {
    long long k = (a[i] - a[l - 1]) - (a[r] - a[i]);
    if (k > ret) ret = k, pos = i;
  }
  return make_pair(ret, pos);
}
int main() {
  n = rd();
  for (int i = (1), i_end = (n); i <= i_end; i++) {
    a[i] = rd() + a[i - 1];
  }
  long long mx = 0;
  int a = 0, b = 0, c = 0;
  for (int i = (0), i_end = (n); i <= i_end; i++) {
    pair<long long, int> first = calc(1, i), second = calc(i + 1, n);
    if (first.first + second.first > mx) {
      mx = first.first + second.first;
      a = first.second, b = i, c = second.second;
    }
  }
  cout << a << " " << b << " " << c << endl;
}
