#include <bits/stdc++.h>
using namespace std;
const int N = 300002;
int n, v[N];
unsigned long long s1, s2, s3;
int main() {
  int i;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> v[i];
    s1 += v[i];
  }
  sort(v + 1, v + n + 1);
  if (n <= 1) {
    cout << s1;
    return 0;
  }
  s2 = 2 * s1;
  for (int i = 1; i < n - 1; i++) {
    s1 -= v[i];
    s2 += s1;
  }
  cout << s2;
  return 0;
}
