#include <bits/stdc++.h>
using namespace std;
int a[300010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  if (n == 1) {
    printf("%d\n", a[0]);
    return 0;
  }
  sort(a, a + n);
  long long ans = 0, now = 2;
  for (int i = 0; i < n; i++) {
    ans += now * a[i];
    now++;
    if (now > n) now = n;
  }
  printf("%I64d\n", ans);
  return 0;
}
