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