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