#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, score = 0, cnt = 0, sum = 0;
  vector<long long> v;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a;
    v.push_back(a);
    sum += a;
  }
  sort(v.rbegin(), v.rend());
  while (n != 0) {
    if (cnt == 0) {
      score += sum;
      cnt++;
    } else {
      if (n >= 2) score += v[n - 1];
      n--;
      if (n >= 2) {
        score += sum - v[n];
        sum -= v[n];
      } else if (n == 1) {
        score += v[n - 1];
        n--;
      } else if (n == 0)
        continue;
    }
  }
  cout << score << endl;
  return 0;
}
