#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long ar[n];
  for (long long i = 0; i < n; i++) cin >> ar[i];
  long long pr1[n + 1], pr2[n + 1];
  pr1[0] = pr2[n] = 0;
  for (long long i = 0; i < n; i++) {
    pr1[i + 1] = pr1[i] + ar[i];
  }
  for (long long i = n - 1; i >= 0; i--) {
    pr2[i] = pr2[i + 1] + ar[i];
  }
  long long a = 0, b = 0, c = 0, su = -1e18;
  for (long long i = 0; i <= n; i++) {
    long long s1 = -1e9, s2 = -1e9;
    long long ta, tb, tc;
    for (long long j = 0; j <= i; j++) {
      long long t1 = pr1[j], t2 = pr1[i] - pr1[j];
      if (s1 < t1 - t2) {
        ta = j;
      }
      s1 = max(t1 - t2, s1);
    }
    for (long long j = i; j <= n; j++) {
      long long t1 = pr1[j] - pr1[i], t2 = pr1[n] - pr1[j];
      if (s2 < t1 - t2) {
        tc = j;
      }
      s2 = max(t1 - t2, s2);
    }
    if (su < s1 + s2) {
      su = s1 + s2;
      a = ta;
      b = i;
      c = tc;
    }
  }
  cout << a << " " << b << " " << c;
  return 0;
}
