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