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