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