#include <bits/stdc++.h>
using namespace std;
const long long N = 3 * 100001;
long long v[N + 1];
int main() {
  memset(v, 0, sizeof(v));
  long long n, SUM = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    SUM += v[i];
  }
  sort(v, v + n);
  long long y = SUM;
  for (int i = 0; i < n - 1; i++) {
    SUM += v[i];
    SUM += y - v[i];
    y -= v[i];
  }
  cout << SUM;
  return 0;
}
