#include <bits/stdc++.h>
using namespace std;
long long int arr[1000000];
int main() {
  long long int n, sum = 0, ans = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  if (n == 1) {
    cout << sum << endl;
    return 0;
  }
  sort(arr, arr + n);
  ans += sum + sum;
  for (long long i = 0; i < n - 2; i++) {
    sum -= arr[i];
    ans += sum;
  }
  cout << ans << endl;
  return 0;
}
