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