#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:167772160")
int comp(const void* a, const void* b) {
  return (*(long long*)a) - (*(long long*)b);
}
int main() {
  int n;
  long long mas[300000], ans(0);
  scanf("%d", &n);
  for (int i(0); i < n; ++i) scanf("%I64d", &mas[i]);
  qsort(mas, n, sizeof(long long), comp);
  for (int i(0); i < n; ++i) ans += mas[i] * (2 + i);
  ans -= mas[n - 1];
  printf("%I64d", ans);
  return 0;
}
