#t354. 排队接水(water)

排队接水(water)

Queue for Water

Problem Description

There are nn people queuing in front of a tap to get water. Suppose the ii-th person takes TiT_i time to get water. Find an ordering of the nn people such that their average waiting time is minimized.

Input Format

The first line is an integer nn.

The second line contains nn integers, where the ii-th integer TiT_i is the water-fetching time of the ii-th person.

Output Format

Output two lines. The first line is an ordering that gives the shortest average waiting time. The second line is the average waiting time under this ordering (kept to two decimal places).

Sample Input

10
56 12 1 99 1000 234 33 55 99 812

Sample Output

3 2 7 8 1 4 9 6 10 5
532.00

Constraints

1≤n≤10001\le n \leq 1000, 1≤ti≤1061\le t_i \leq 10^6; the tit_i are not guaranteed to be distinct.