#include <bits/stdc++.h>
using namespace std;
long long sumOrig = 0, sum;
int main(int argc, const char* argv[]) {
  long long n, i, a[300005];
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sumOrig += a[i];
  }
  sort(a + 0, a + n);
  sum = sumOrig;
  if (n >= 2) {
    sum += sumOrig;
    for (i = 0; i < n - 2; i++) {
      sumOrig -= a[i];
      sum += sumOrig;
    }
  }
  cout << sum;
  return 0;
}
