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