#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long n, temp, score = 0, sum = 0, total = 0, singsum = 0;
  cin >> n;
  unsigned long long group[n], cumsum[n], ans[n];
  for (int i = 0; i < n; i++) scanf("%lld", &group[i]);
  if (n == 1)
    cout << group[0] << endl;
  else {
    sort(group, group + n);
    for (int i = 0; i < n; i++) singsum += group[i];
    for (int i = 0; i < n; i++) {
      sum += group[i];
      cumsum[i] = sum;
    }
    for (int i = 0; i < n; i++) {
      ans[i] = (singsum - cumsum[i]);
    }
    for (int i = 0; i < n; i++) {
      total += ans[i];
    }
    for (int i = 0; i < n - 1; i++) {
      total += group[i];
    }
    cout << total + singsum << endl;
  }
  return 0;
}
