#include <bits/stdc++.h>
int cmp(const void *a, const void *b) { return *(int *)a - *(int *)b; }
int main() {
  long long int n, i, count, sum = 0, p = 0;
  scanf("%I64d", &n);
  long long int str[n];
  for (i = 0; i < n; i++) {
    scanf("%I64d", &str[i]);
    sum = sum + str[i];
  }
  qsort(str, n, sizeof *str, cmp);
  count = sum;
  for (i = 0; i < n - 1; i++) {
    count = count + sum - p;
    p = p + str[i];
  }
  printf("%I64d", count);
  return 0;
}
