#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n), p(n);
  for (auto &it : a) cin >> it;
  sort(a.rbegin(), a.rend());
  p[0] = a[0];
  for (long long i = 1; i < n; i++) p[i] = p[i - 1] + a[i];
  long long ans = p[n - 1];
  for (long long i = 0; i < n - 1; i++) {
    ans += a[n - 1 - i];
    ans += p[n - 2 - i];
  }
  cout << ans << "\n";
}
