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