#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  long long ans = 0;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
    sum += v[i];
  }
  sort(v.begin(), v.end());
  ans = sum;
  if (n == 1)
    ;
  if (n == 2)
    ans += sum;
  else
    for (int i = 0; i <= n - 2; i++) {
      ans += sum;
      sum -= v[i];
    }
  cout << ans << endl;
  return 0;
}
