#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, con, score = 0;
  cin >> n;
  long long *a = new long long[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    score += a[i];
  }
  sort(a, a + n);
  con = score;
  int j = 1;
  while (j < n) {
    score += con;
    con -= a[j - 1];
    j++;
  }
  cout << score;
  return 0;
}
