#include <bits/stdc++.h>
using namespace std;
int a[300000 + 1];
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n, greater<int>());
  long long score = (long long)a[0] * n;
  for (int i = 1, times = n; i < n; ++i, --times) {
    score += (long long)a[i] * times;
  }
  printf("%I64d\n", score);
  return 0;
}
