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