#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

void solve()
{
	int n;
	while(cin >> n)
	{
		vector<int> Vec(n);
		for(int i = 0; i < n; ++i)
		{
			cin >> Vec[i];
		}
		sort(Vec.begin(), Vec.end(), greater<int>());
		int sum = 0;
		for(int i = n; i >= 1; --i)
		{
			sum += i * Vec[i - 1];
		}
		cout << sum << endl;
	}
}

int main()
{
	solve();
	return(0);
}