#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,i,a[150],j;
    long long s;
    while(scanf("%d",&n)!=EOF){
        for(i=0;i<n;i++){
            scanf("%d",&a[i]);
        }
        for(i=0;i<n;i++){
            for(j=i+1;j<n;j++){
                if(a[j]<a[i]){
                    s=a[j];
                    a[j]=a[i];
                    a[i]=s;
                }
            }
        }
        s=0;
        for(i=0,j=n;i<n;i++,j--){
            s+=j*a[i];
        }
        printf("%lld\n",s);

    }
}