#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, sum = 0;
  cin >> n;
  vector<long long> arr(n);
  for (int i = 0; i < n; cin >> arr[i], sum += arr[i++])
    ;
  sort(arr.begin(), arr.end());
  for (int x = 0, y = 1; x < n; x++, y++) {
    if (x == n - 1)
      y--, sum += y * arr[x];
    else
      sum += (y * arr[x]);
  }
  cout << sum;
  return 0;
}
