#include <bits/stdc++.h>
using namespace std;
inline long long int in() {
  long long int n = 0;
  long long int ch = getchar();
  long long int sign = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') sign = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    n = (n << 3) + (n << 1) + ch - '0', ch = getchar();
  return n * sign;
}
long long int arr[300002], ct[300002];
int main() {
  long long int n;
  n = in();
  for (long long int i = 0; i < n; i++) arr[i] = in();
  sort(arr, arr + n);
  for (long long int i = n - 1; i >= 0; i--) {
    if (i != n - 1)
      ct[i] = ct[i + 1] + arr[i];
    else
      ct[i] = arr[i];
  }
  long long int ans = 0, j = 0;
  for (long long int i = 0; i < n - 1; i++) ans += arr[i] + ct[i];
  ans += arr[n - 1];
  cout << ans;
}
