// Aizu Vol-10 1018: Cheating on ICPC
// 2017.8.20 bal4u@uu

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

int p[102];

int cmp(int *a, int *b) { return *a - *b; }

int main()
{
	int N;
	int i, s, k;

	while (scanf("%d", &N) == 1) {
		for (i = 0; i < N; i++) scanf("%d", p + i);
		qsort(p, N, sizeof(int), cmp);
		for (s = 0, k = N, i = 0; i < N; i++, k--) s += p[i]*k;
		printf("%d\n", s);
	}
	return 0;
}