#include <bits/stdc++.h>
using namespace std;
long long int num[10000], prefix_sum[10000];
int main() {
  ios_base::sync_with_stdio(false);
  long long int n;
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      cin >> num[i];
      if (i == 0) {
        prefix_sum[i] = 0;
      } else {
        prefix_sum[i] = prefix_sum[i - 1] + num[i - 1];
      }
    }
    prefix_sum[n] = prefix_sum[n - 1] + num[n - 1];
    long long int cur = (-prefix_sum[n]) - prefix_sum[0];
    long long int delim1 = 0, delim2 = 0, delim3 = 0;
    for (int i = 0; i <= n; i++) {
      long long int curmin = prefix_sum[i], index = i;
      for (int j = i; j <= n; j++) {
        if (prefix_sum[j] < curmin) {
          index = j;
          curmin = prefix_sum[j];
        }
        if ((-prefix_sum[n]) - prefix_sum[0] + 2 * prefix_sum[i] +
                2 * prefix_sum[j] - 2 * prefix_sum[index] >
            cur) {
          cur = (-prefix_sum[n]) - prefix_sum[0] + 2 * prefix_sum[i] +
                2 * prefix_sum[j] - 2 * prefix_sum[index];
          delim1 = i;
          delim3 = j;
          delim2 = index;
        }
      }
    }
    cout << delim1 << ' ' << delim2 << ' ' << delim3 << '\n';
  }
}
