#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n], s = 0, t = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s += a[i];
  }
  t = s;
  sort(a, a + n);
  for (int i = 0; i < n - 1; i++) {
    t = t - a[i];
    s = s + (t + a[i]);
  }
  cout << s;
  return 0;
}
