#include <bits/stdc++.h>
using namespace std;
const int N = 3 * 1e5 + 10;
int n, k;
long long data[N];
const int D[5][2] = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}};
int scan() {
  char cc = ' ';
  int re = 0, fh = 1;
  while (cc == ' ' || cc == '\r' || cc == '\n') cc = getchar();
  if (cc == '+') cc = getchar(), fh = 1;
  if (cc == '-') cc = getchar(), fh = -1;
  while ('0' <= cc && cc <= '9') {
    re = re * 10 + cc - '0';
    cc = getchar();
  }
  return re * fh;
}
int main() {
  int i, j, a;
  n = scan();
  for (i = 1; i <= n; i++) data[i] = scan();
  sort(data + 1, data + 1 + n);
  for (i = 1; i <= n; i++) data[i] += data[i - 1];
  long long ans = data[n];
  for (i = 1; i < n; i++) ans += data[n] - data[i - 1];
  printf("%I64d\n", ans);
  return 0;
}
