#include <bits/stdc++.h>
using namespace std;
long long int v[1400000], a, b, c, d, i, j, m, n, r,
    h[] = {4, 7, 44, 47, 74, 77, 444, 447, 474, 477, 744, 747, 774, 777}, maxi,
    mini, ul;
char s[10000], w[10000], ch;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> v[i];
  }
  sort(v + 1, v + 1 + n);
  d = 1;
  for (i = 1; i <= n; i++) {
    if (i + 1 <= n) d++;
    r += v[i] * d;
  }
  cout << r;
  return 0;
}
