#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, t;
  long long sum = 0;
  cin >> n;
  vector<long long int> num;
  for (int i = 0; i < n; i++) {
    cin >> t;
    sum += t;
    num.push_back(t);
  }
  sort(num.begin(), num.end());
  long long int score = sum;
  for (int j = 0; j < n - 1; j++) {
    score += sum;
    sum -= num[j];
  }
  cout << score << endl;
  return 0;
}
