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