#include <bits/stdc++.h>
using namespace std;
vector<long long> Data;
pair<int, long long> res(int from, int to) {
  pair<int, long long> ans;
  ans.second = LLONG_MIN;
  for (int i = from; i <= to; ++i) {
    long long var = (Data[i] - Data[from]) - (Data[to] - Data[i]);
    if (var > ans.second) {
      ans.first = i;
      ans.second = var;
    }
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  Data.resize(n + 1);
  for (int i = 1; i <= n; ++i) {
    cin >> Data[i];
    Data[i] += Data[i - 1];
  }
  long long Maxximal = LLONG_MIN;
  int d1, d2, d3;
  for (int i = 0; i <= n; ++i) {
    pair<int, long long> First = res(0, i), Second = res(i, n);
    if (First.second + Second.second > Maxximal) {
      d1 = First.first, d2 = i, d3 = Second.first;
      Maxximal = First.second + Second.second;
    }
  }
  cout << d1 << ' ' << d2 << ' ' << d3;
  return 0;
}
