package main import . "fmt" import . "slices" func main() { var n int Scan(&n) a:=make([]int64,n) for i:=range a { Scan(&a[i]) } Sort(a) Reverse(a) var ans int64 for i:=0;len(a)>0;i++ { for x:=0;x<1<0;x++ { ans+=a[0]*int64(i) a=a[1:] } } Println(ans) }