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