#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 9;
int x[N];
long long acc[N];
int main() {
  int n;
  scanf("%d", &n);
  for (__typeof(n) i = 0; i < n; ++i) scanf("%d", x + i);
  sort(x, x + n);
  acc[n - 1] = x[n - 1];
  for (__typeof(n - 2) i = n - 2; i > -1; --i) acc[i] = acc[i + 1] + x[i];
  long long sum = acc[0];
  for (__typeof(n - 1) i = 0; i < n - 1; ++i) sum += acc[i];
  printf("%I64d\n", sum);
  return 0;
}
