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

#define N 100

int compare_int(const void *a,const void *b) {
	int arg_1 = *(const int*)a;
	int arg_2 = *(const int*)b;
	if (arg_1 > arg_2) return 1;
	if (arg_1 < arg_2) return -1;
	return 0;
}

int main(void) {
	int n;
	int problem[N];
	int i;
	int sum;

	while (scanf("%d",&n) != EOF) {
		for (i = 0;i < n;++i) {
			scanf("%d",&problem[i]);
		}
		qsort(problem,n,sizeof(int),compare_int);
		sum = 0;
		for (i = 0;i < n;++i) {
			sum += problem[i]*(n- i);
		}
		printf("%d\n",sum);
	}
	return 0;
}