#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, t, p = 1, ctr = 0, n, k, sum = 0, ans = 0;
  cin >> n;
  vector<long long int> v(n), s(n + 1);
  s[0] = 0;
  for (i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  for (i = 0; i < n; i++) {
    sum += v[i];
    s[i + 1] = sum;
  }
  for (i = 0; i <= n; i++) {
    ans += s[n] - s[i];
  }
  ans += s[n - 1];
  cout << ans << endl;
}
