#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<long long int> v;
  for (long long int i = 0; i < n; i++) {
    long long int num;
    cin >> num;
    v.push_back(num);
  }
  if (n == 1) {
    cout << v[0] << endl;
  } else {
    vector<long long int> sumas;
    long long int sum = 0;
    sort(v.begin(), v.end());
    for (long long int i = v.size() - 1; i != 0; i--) {
      sum += v[i];
      sumas.push_back(sum);
    }
    sumas.push_back(sum + v[0]);
    long long int it = sumas.size() - 1, total = 0;
    for (int i = 0; i < n; i++) {
      total += sumas[it];
      if (i + 1 == n) break;
      total += v[i];
      it--;
    }
    cout << total;
  }
  return 0;
}
