#include <bits/stdc++.h>
using namespace std;
long long a[int(1e6 + 6)], i, m, ans, k, l, j, x, n, ma, mi;
string s;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + 1 + n);
  for (int i = 1; i < n; i++) ans += (i + 1) * a[i];
  cout << ans + a[n] * n << endl;
}
