This page is still under construction.

Parts of this page are still being built. What you see may change.

Pikule

Time limit1sMemory limit1024 MB

Level

Not classified yet

Solved
No attempts yet

Statement

Pikule are round, shiny marbles that children used to play with. Every pikule in our world has one integer written on it. When a pikule with value YY is struck into a pikule with value XX, the pikule with value YY disappears and the struck pikule's value changes from XX to X−YX-Y.

Dodo lined up NN pikules from left to right, numbered by position from 11 to NN. At the start, the pikule at position ii has the number AiA_i. The game goes as follows. In each step, Dodo picks one pikule at a position between 22 and NN and pushes it to the left. The pikule keeps moving until it hits another pikule, and then the two merge as described above. After N−1N-1 pushes, only the pikule at position 11 remains.

Dodo loves big numbers. He wants to know the largest number that can remain on the last pikule, and the order in which he should push the pikules to reach it.

Input

The first line contains a natural number NN (1≤N≤1051 \le N \le 10^5).

The second line contains NN integers A1,…,ANA_1, \ldots, A_N (−109≤Ai≤109-10^9 \le A_i \le 10^9), the numbers on the pikules.

Output

Print the number that remains on the final pikule on the first line.

On each of the next N−1N-1 lines, print the position of the pikule Dodo pushes at step ii. A pikule must already be at that position when it is pushed.

Hint

First sample: Dodo can only push the second pikule. Then the first pikule's value becomes −1-1, which is the final maximum.

Second sample: There are two possible push orders. In order {2, 3}, he first pushes the pikule at position 2, leaving 2 _ 1. Then he pushes position 3, leaving a single pikule with value 1. The better order is {3, 2}. After the first push the row is 3 0 _, and after the last push the remaining pikule has value 3, which is optimal.

Examples2

  1. Example 1

    Input
    2
    5 6
    
    Expected output
    -1
    2
    
  2. Example 2

    Input
    3
    3 1 1
    
    Expected output
    3
    3
    2