#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, c = 0, sum = 0, a, i;
  vector<long long> v;
  cin >> n;
  while (n--) {
    cin >> a;
    v.push_back(a);
    c += a;
  }
  sort(v.begin(), v.end());
  for (i = 0; i < v.size() - 1; i++) {
    sum += c;
    c -= v[i];
    sum += v[i];
  }
  sum += v[v.size() - 1];
  cout << sum << endl;
  return 0;
}
