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