#include<iostream>
using namespace std;
int main() {
	int a[10000],x,y,n,c;
	c = 0;
	cin >> n;
	for (int k = 0; k < n; k++) {
		cin >> a[k];
	}
	for (int j = 0; j < n; j++) {
		for (int i = 0; i < n-1; i++) {
			if (a[i] > a[i + 1]) {
				x = a[i];
				y = a[i + 1];
				a[i] = y;
				a[i + 1] = x;
			}
		}
	}
	for (int k = 0; k < n; k++) {
		c = c + a[k] * (n - (k + 1));
	}
	cout << c << endl;
	return 0;
}