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