#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int s = 0;
  int i, *ara;
  ara = (int *)malloc(n * sizeof(int));
  for (i = 0; i < n; i++) {
    cin >> ara[i];
    s += ara[i];
  }
  sort(ara, ara + n);
  long long int sum;
  i = 0;
  sum = s;
  while (i < n - 1) {
    sum += ara[i] + (s - ara[i]);
    s -= ara[i];
    i++;
  }
  cout << sum;
  return 0;
}
