#include <bits/stdc++.h>
using namespace std;
long long n;
long long nums[300005];
int main() {
  memset(nums, 0, sizeof(nums) / sizeof(int));
  cin >> n;
  for (int i = 0; i < n; i++) cin >> nums[i];
  sort(nums, nums + n);
  long long answer = 0;
  long long counter = 2;
  for (int i = 0; i < n; i++) {
    answer += nums[i] * counter;
    if (counter != n) counter++;
  }
  if (n == 1)
    cout << nums[0] << endl;
  else
    cout << answer << endl;
  return 0;
}
