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