#include <bits/stdc++.h>
using namespace std;
long long num[5001], sum[5001];
int n, p1, p2, p3;
int main() {
  int i, j;
  long long x, mx = -1e15;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%I64d", &x);
    sum[i] = sum[i - 1] + x;
  }
  for (i = 1; i <= n; i++) {
    int l, r;
    l = r = i;
    for (j = 0; j <= i; j++) {
      if (sum[j] > sum[l]) l = j;
    }
    for (j = i; j <= n; j++) {
      if (sum[j] > sum[r]) r = j;
    }
    if (2 * sum[l] + 2 * sum[r] - 2 * sum[i] - sum[n - 1] > mx) {
      mx = 2 * sum[l] + 2 * sum[r] - 2 * sum[i] - sum[n - 1];
      p1 = l, p2 = i, p3 = r;
    }
  }
  cout << p1 << " " << p2 << " " << p3 << endl;
}
