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