#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n + 1];
  memset(a, 0, sizeof(a));
  for (long long i = 1; i <= n; i++) cin >> a[i];
  sort(a, a + n + 1);
  long long sum[n + 1];
  memset(sum, 0, sizeof(sum));
  sum[1] = a[1];
  for (int i = 2; i <= n; i++) {
    sum[i] = sum[i - 1] + a[i];
  }
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    ans = ans + a[i] + (sum[n] - sum[i]);
  }
  cout << ans - a[n] << endl;
  return 0;
}
