#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  long long int n;
  int nos[400002] = {0};
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> nos[i];
  }
  sort(nos, nos + n);
  long long int ans = 0;
  for (long long int i = 0; i < n - 1; i++) {
    ans += nos[i] * (i + 2);
  }
  ans += nos[n - 1] * n;
  cout << ans << endl;
  return 0;
}
