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