#include<stdio.h>

int main(){

  int n, data[100], i, j, stock, sum, newdata[100];

  while(scanf("%d",&n) != EOF){

    sum = 0;

    for(i = 0; i < n; i++){
      newdata[i] = 0;
    }
    for(i = 0; i < n; i++){
      scanf("%d",&data[i]);
    }

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

    for(i = 0; i < n; i++){
      for(j = 0; j <= i; j++){
	newdata[i] += data[j];
      }
      //printf("%d\n",data[i]);
    }

    for(i = 0; i < n; i++){
      sum += newdata[i];
    }

    printf("%d\n",sum);
  }

  return 0;
}