Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

C. Four Segments

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou are given an array of *n* integer numbers. Let *sum*(*l*, *r*) be the sum of all numbers on positions from *l* to *r* non-inclusive (*l*-th element is counted, *r*-th element is not counted). For indices *l* and *r* holds 0 ≤ *l* ≤ *r* ≤ *n*. Indices in array are numbered from 0.

For example, if *a* = [ - 5, 3, 9, 4], then *sum*(0, 1) = - 5, *sum*(0, 2) = - 2, *sum*(1, 4) = 16 and *sum*(*i*, *i*) = 0 for each *i* from 0 to 4.

Choose the indices of three delimiters *delim*_{0}, *delim*_{1}, *delim*_{2} (0 ≤ *delim*_{0} ≤ *delim*_{1} ≤ *delim*_{2} ≤ *n*) and divide the array in such a way that the value of *res* = *sum*(0, *delim*_{0}) - *sum*(*delim*_{0}, *delim*_{1}) + *sum*(*delim*_{1}, *delim*_{2}) - *sum*(*delim*_{2}, *n*) is maximal.

Note that some of the expressions *sum*(*l*, *r*) can correspond to empty segments (if *l* = *r* for some segment).

Input

The first line contains one integer number *n* (1 ≤ *n* ≤ 5000).

The second line contains *n* numbers *a*_{0}, *a*_{1}, ..., *a*_{n - 1} ( - 10^{9} ≤ *a*_{i} ≤ 10^{9}).

Output

Choose three indices so that the value of *res* is maximal. If there are multiple answers, print any of them.

Examples

Input

3

-1 2 3

Output

0 1 3

Input

4

0 0 -1 0

Output

0 0 0

Input

1

10000

Output

1 1 1

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Feb/22/2018 06:10:20 (d1).

Desktop version, switch to mobile version.

User lists

Name |
---|