#include <bits/stdc++.h>
using namespace std;
void parr(int arr[], int n, string name) {
  int i;
  for (i = 0; i < n; i++) cout << arr[i] << " ";
  cout << "\n";
}
long long int fn(int arr[], int n) {
  int i;
  long long int pre[n];
  sort(arr, arr + n, greater<int>());
  pre[0] = arr[0];
  for (i = 1; i < n; i++) pre[i] = pre[i - 1] + arr[i];
  cout << "\n";
  long long int ans = 0;
  for (i = 0; i < n; i++) ans += pre[i];
  for (i = 1; i < n; i++) ans += arr[i];
  return ans;
}
int main() {
  int n;
  cin >> n;
  int arr[n];
  int i;
  for (i = 0; i < n; i++) cin >> arr[i];
  long long int ans = fn(arr, n);
  cout << ans;
}
