#include<stdio.h>

int a[100];

int main(void){
  int i,j,n;
  int time,tmp;

  while(scanf("%d",&n)!=EOF){
    time = 0;
    for(i=0;i<n;i++){
      scanf("%d",&a[i]);
    }

    for(i=0;i<n-1;i++){
      for(j=n-1;j>i;j--){
	if(a[i]>a[j]){
	  tmp = a[i];
	  a[i] = a[j];
	  a[j] = tmp;
	}
      }
    }

    for(i=0;i<n;i++){
    time += (n-i)*a[i];
    }

    printf("%d\n",time);
  }
  return 0;
}