#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long int n, ans = 0, sum = 0;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a, a + n);
  int q = 0;
  for (int i = 0; i < n; i++) {
    ans += sum;
    q++;
    sum -= a[i];
    if (q != n) ans += a[i];
    ;
  }
  cout << ans;
}
