#include <bits/stdc++.h>
using namespace std;
struct _ {
  ios_base::Init i;
  _() {
    cin.sync_with_stdio(0);
    cin.tie(0);
  }
} _;
int main() {
  long long ans = 0;
  long long s = 0;
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    s += a[i];
  }
  sort(a.begin(), a.end());
  int i = 0;
  ans = s;
  while (i < n - 1) {
    ans += s;
    s -= a[i++];
  }
  cout << ans << endl;
  return 0;
}
