#include <bits/stdc++.h>
using namespace std;
const int maxn = 500000 + 100;
long long summmmmmm[maxn], a[maxn];
int n;
int main() {
  cin >> n;
  summmmmmm[0] = a[0] = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; ++i) summmmmmm[i] = summmmmmm[i - 1] + a[i];
  long long ressssssssss = 0;
  for (int i = 0; i < n; ++i) {
    ressssssssss = ressssssssss + (summmmmmm[n] - summmmmmm[i]) + a[i];
  }
  cout << ressssssssss << endl;
  return 0;
}
