#include <bits/stdc++.h>
using namespace std;
int A[300010];
int n;
void enter() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", A + i);
  sort(A, A + n);
}
void solve() {
  int64_t s = 0, r;
  int i;
  for (i = 0; i < n; ++i) s += A[i];
  r = s;
  for (i = 0; i < n - 1; ++i) {
    r += s;
    s -= A[i];
  }
  printf("%I64d", r);
}
int main() {
  enter();
  solve();
  return 0;
}
