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