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