#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T sqr(T x) {
  return x * x;
}
template <typename T>
inline T getNext() {
  T s = 1, x = 0, c = getc(stdin);
  while (c <= 32) c = getc(stdin);
  if (c == '-') s = -1, c = getc(stdin);
  while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getc(stdin);
  return x * s;
}
const int MaxN = int(1e5);
long long a[MaxN * 4];
long long d[MaxN * 4];
int main() {
  long long n = getNext<long long>();
  for (int i = 0; i < n; ++i) {
    a[i] = getNext<long long>();
  }
  sort(a, a + n);
  for (int i = 0; i < n; ++i) {
    d[i] = d[i - 1] + a[i];
  }
  long long res = 0ll;
  for (int i = 0; i < n; ++i) {
    if (n - i < 2) {
      res += a[i];
      continue;
    }
    res += a[i] + (d[n - 1] - d[i - 1]);
  }
  cout << res;
  return 0;
}
