#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    int a[n];
    long long s = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      s += a[i];
    }
    long long ans = s;
    sort(a, a + n);
    int i = 0;
    while (n > 1) {
      ans += s;
      s = s - a[i];
      n--;
      i++;
    }
    cout << ans;
  }
  return 0;
}
