#include<bits/stdc++.h>
using namespace std;
struct node{
int t;
int num;
}a[1005];
bool cmp(const node &x, const node &y){
return (x.t == y.t) ? (x.num < y.num ) : (x.t < y.t);
}
int main(){
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++){
a[i].num = i;
scanf("%d", &a[i].t);
}
sort(a + 1, a + 1 + n, cmp);
int v = 0;
for (int i = 1; i <= n; i++){
printf("%d ", a[i].num);
v += a[i].t * (n - i);
}
printf("\n%.2llf", v * 1.0 / n);
return 0;
}