import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] times = new int[n];
int[] originalsat = new int[n];
Integer[] indexTime = new Integer[n];
for (int i = 0; i < n; i++) {
times[i] = scanner.nextInt();
originalsat[i] = i + 1;
}
for (int i = 0; i < n; i++) {
indexTime[i] = i;
}
Arrays.sort(indexTime, Comparator.comparingInt(a -> times[a]));
int totalWaiting = 0;
StringBuilder order = new StringBuilder();
for (int i = 0; i < n; i++) {
totalWaiting += times[indexTime[i]] * (n - i - 1);
order.append(originalsat[indexTime[i]]).append(" ");
}
double aveWaiting = (double) totalWaiting / n;
System.out.println(order);
System.out.printf("%.2f", aveWaiting);
scanner.close();
}
}