#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n;
	while (cin >> n) {
		long long  a[101];
		long long sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		sort(a, a + n);
		for (int i = 0; i < n; i++) {
			if (i == 0) 
				sum += a[0];
			else {
				a[i] += a[i - 1];
				sum += a[i];
			}
		}
		cout << sum << endl;
	}
}