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