#include <bits/stdc++.h>
using namespace std;
const int rx[] = {0, -1, 0, 1, -1, 1, 1, -1};
const int cy[] = {1, 0, -1, 0, 1, 1, -1, -1};
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  long long sum = 0, l, r;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += (long long)a[i];
  }
  r = sum;
  sort(a.begin(), a.end());
  for (int i = 0; i < n - 1; i++) {
    sum += (long long)a[i];
    r -= (long long)a[i];
    sum += r;
  }
  cout << sum << endl;
  return 0;
}
