403735: GYM101246 J Buoys

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. Buoystime limit per test1 secondmemory limit per test256 megabytesinputinput.txtoutputoutput.txt

The swimming area of Berhattan's city beach is marked out with n buoys. The buoys form a straight line. When the buoys were being put into the water, nobody cared to observe the same distance between each pair of adjacent buoys.

Now the beach keeper wants the distance between any two adjacent buoys to be the same. He plans to shift some or all of the buoys without changing their respective order. To facilitate the task, he wants the total length of all shifts to be as small as possible.

Given coordinates of the buoys, you should find the minimum possible length of all shifts, as well as new coordinates of the buoys.

Input

The first line of input contains a single integer n (2 ≤ n ≤ 400), n — the number of buoys. The second line contains buoys' integer coordinates x1, x2, ..., xn ( - 10000 ≤ xi ≤ 10000). No two given buoys will share the same place. The coordinates are given in strictly increasing order.

Output

To the first line print a real number t — the minimum possible total length of required shifts. Output this value with at least 4 digits after the decimal point.

To the second line print n numbers — new coordinates of the buoys. The new coordinates should be printed in strictly increasing order with at least 7 digits after the decimal point. If there are several optimal ways to shift the buoys, you may output any of them.

ExamplesInput
4
-2 2 6 9
Output
1.0000
-2.0000000000 1.6666666667 5.3333333333 9.0000000000
Note

All buoys are located on the Ox axis. You may move buoys only along the Ox axis.

加入题单

上一题 下一题 算法标签: