#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int rd() {
  int t;
  scanf("%d", &t);
  return t;
}
long long a[maxn], pre[maxn][5], dp[maxn][5];
long long s[maxn];
void print(int x, int dep) {
  if (dep == 0) {
    return;
  }
  print(pre[x][dep], dep - 1);
  cout << x << ' ';
}
signed main() {
  memset(dp, 0xcf, sizeof(dp));
  register int n = rd();
  for (register int i = 1; i <= n; i++) a[i] = rd(), s[i] = s[i - 1] + a[i];
  dp[0][0] = 0;
  dp[0][1] = 0;
  dp[0][2] = 0;
  dp[0][3] = 0;
  for (register int i = 1; i <= n; i++) {
    for (register int k = 1; k <= 4; k++) {
      for (register int j = 0; j <= i; j++) {
        if (k & 1) {
          if (dp[j][k - 1] + s[i] - s[j] > dp[i][k]) {
            dp[i][k] = dp[j][k - 1] + s[i] - s[j];
            pre[i][k] = j;
          }
        } else {
          if (dp[j][k - 1] - s[i] + s[j] > dp[i][k]) {
            dp[i][k] = dp[j][k - 1] - s[i] + s[j];
            pre[i][k] = j;
          }
        }
      }
    }
  }
  print(pre[n][4], 3);
  return 0;
}
