var i,j,k,l,m,n:longint;
ans:real;
a,b:array[1..3000]of longint;
procedure qsort(l,r:longint);
var i,j,mid,tmp:longint;
begin
i:=l; j:=r;
mid:=a[(i+j) div 2];
repeat
while a[i]<mid do inc(i);
while a[j]>mid do dec(j);
if i<=j then
begin
tmp:=a[i]; a[i]:=a[j]; a[j]:=tmp;
tmp:=b[i]; b[i]:=b[j]; b[j]:=tmp;
inc(i); dec(j);
end;
until i>j;
if l<j then qsort(l,j);
if i<r then qsort(i,r);
end;
begin
assign(input,'jieshui.in');
reset(input);
assign(output,'jieshui.out');
rewrite(output);
readln(n);
for i:=1 to n do begin read(a[i]); b[i]:=i; end;
qsort(1,n);
l:=0;
for i:=1 to n-1 do
begin
l:=l+a[i];
ans:=ans+l;
end;
for i:=1 to n do write(b[i],' ');
writeln;
writeln(ans/n:0:2);
close(input);
close(output);
end.