#include <bits/stdc++.h>
using namespace std;
long long n, a[300005], i;
int main() {
  while (cin >> n) {
    a[0] = 0;
    long long tsum = 0, res = 0;
    for (i = 1; i <= n; i++) {
      cin >> a[i];
      tsum += a[i];
    }
    sort(a + 1, a + n + 1);
    long long sum = 0;
    for (i = 0; i < n; i++) {
      sum += a[i];
      res += tsum - sum + a[i];
    }
    cout << res << endl;
  }
  return 0;
}
