Trees

No attempts yetTime limit1sMemory limit128 MB

Problem

Byteasar has planted nn trees in a single row. He dislikes the order they stand in, because tall and short trees are mixed together.

To measure how untidy the row is, he uses a disorder coefficient. If the heights of the trees from left to right are h1,h2,,hnh_1, h_2, \ldots, h_n, the coefficient is

h1h2+h2h3++hn1hn|h_1 - h_2| + |h_2 - h_3| + \cdots + |h_{n-1} - h_n|

The smaller this value, the tidier the row.

Replanting is hard work, so Byteasar moves at most two trees: he may pick two trees and swap their positions, or leave the row unchanged. For each tree, find the smallest disorder coefficient that can be reached if that tree is swapped with some other tree, where leaving every tree in place (no swap) is also allowed.

Read the heights of the trees and, for each tree, output the smallest disorder coefficient obtainable by swapping it with another tree or by making no change at all.

Input

The first line contains one integer nn (2n500002 \le n \le 50000).

The second line contains nn integers h1,h2,,hnh_1, h_2, \ldots, h_n (1hi1081 \le h_i \le 10^8), separated by single spaces, giving the heights of the trees from left to right.

Output

Print exactly nn lines. Line ii must contain a single integer: the smallest disorder coefficient that can be attained when tree ii is considered for replanting (swapped with one other tree, or left in place).

Notes

For a fixed tree ii you have two choices: leave the whole row unchanged, or swap tree ii with exactly one other tree. Report the smaller resulting coefficient.

In the first example the value 77 can be reached by swapping trees 11 and 44, trees 22 and 55, or trees 44 and 55, so trees 11, 22, 44 and 55 all reach 77; only tree 33 cannot do better than 88.

In the second example every swap increases the coefficient, so the best choice for every tree is to change nothing, and each answer equals the initial coefficient 44.