#P472. 练85.2 排队接水

练85.2 排队接水

Description

There are nn people waiting in line at a water tap. If the time for the ii-th person to fill water is TiT_i, please write a program to find a queuing order for these nn people that minimizes the average waiting time.

Input Format

The input consists of two lines. The first line contains nn (1n10001 ≤ n ≤ 1000). The second line contains nn integers T1T_1, T2T_2, ..., TnT_n representing the water filling time for each person from 1 to nn, separated by spaces. It is guaranteed that all TiT_i values are distinct.

Output Format

The output consists of two lines. The first line contains a queuing order, which is a permutation of numbers from 1 to nn. The second line contains the average waiting time for this arrangement (accurate to two decimal places).

Sample

10
56 12 1 99 1000 234 33 55 99 812
3 2 7 8 1 4 9 6 10 5
291.90