#include <bits/stdc++.h>
using namespace std;
long long a[300005], n, dem = 0, b[300005];
void Qsort(long d, long c) {
  int i, j, m, x;
  i = d;
  j = c;
  x = a[(d + c) / 2];
  while (i < j) {
    while (a[i] > x) i++;
    while (a[j] < x) j--;
    if (i <= j) {
      swap(a[i], a[j]);
      i++;
      j--;
    }
  }
  if (j > d) Qsort(d, j);
  if (i < c) Qsort(i, c);
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  Qsort(1, n);
  b[0] = 0;
  for (int i = 1; i <= n; i++) b[i] = b[i - 1] + a[i];
  for (int i = 1; i <= n; i++) dem = dem + b[i] + a[i];
  cout << dem - a[1];
  return 0;
}
