#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  long long sum = 0;
  int arr[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    sum += (long long)arr[i];
  }
  if (n == 1) {
    printf("%lld\n", sum);
    return 0;
  }
  sort(arr, arr + n);
  long long orig = sum;
  sum += orig;
  for (int i = 0; i < n; i++) {
    sum += (orig - arr[i]);
    orig -= arr[i];
  }
  sum -= arr[n - 1];
  printf("%lld\n", sum);
  return 0;
}
