#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  long long arr[n], sum = 0, total = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  total += sum;
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    if (i != n - 1)
      total += arr[i] * (i + 1);
    else
      total += arr[i] * i;
  }
  cout << total;
  return 0;
}
