#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, s = 0, i, x, vs = 0;
  vector<int> a;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    a.push_back(x);
    vs += x;
  }
  sort(a.begin(), a.end(), std::greater<int>());
  if (n == 1)
    cout << a[0] << endl;
  else if (n == 2)
    cout << 2 * vs << endl;
  else {
    while (a.size() > 1) {
      s += vs;
      s += a.back();
      vs -= a.back();
      a.pop_back();
    }
    s += a[0];
    cout << s << endl;
  }
}
