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