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

int time_num;
int time_list[100];

int qsort_comp(const void* x,const void* y) {
	int* a=(int*)x;
	int* b=(int*)y;
	if(*a>*b)return 1;
	if(*a<*b)return -1;
	return 0;
}

int main(void) {
	int i;
	int time_sum;
	int result;
	while(scanf("%d",&time_num)==1) {
		for(i=0;i<time_num;i++)scanf("%d",&time_list[i]);
		qsort(time_list,time_num,sizeof(int),qsort_comp);
		for(i=0,result=0,time_sum=0;i<time_num;i++) {
			time_sum+=time_list[i];
			result+=time_sum;
		}
		printf("%d\n",result);
	}
	return 0;
}