#include <iostream>
#include <algorithm>
using namespace std;
int main(void) {
	int n, t[100], w;
	w = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t[i];
	}
	cin >> t[n];
	sort(t, t + n);
	for (int i = 0; i < n; i++) {
		w += t[i] * (n - 1 - i);
	}
	cout << w << endl;
	return 0;
}