#include <bits/stdc++.h>
using namespace std;
const long long N = 3 * 1e5 + 5;
long long arr[N];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  long long sum = 0, score = 0;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  sort(arr, arr + n);
  score = sum;
  for (long long i = 0; i < n - 1; i++) {
    score += sum;
    sum -= arr[i];
  }
  cout << score << "\n";
  return 0;
}
