#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
  int i, n, x, sum;
  vector<int> a;
  vector<int>::iterator it;
  while(cin >> n) {
    sum = 0;
    for(i=n; i>0; i--) {
      cin >> x;
      a.push_back(x);
    }
    sort(a.begin(), a.end(), greater<int>());
    i=1;
    for(it = a.begin(); it != a.end(); it++) {
      sum += *it*i;
      i++;
    }
    cout << sum << endl;
    a.clear();
  }
  return 0;
}
