#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic warning "-Wconversion"
using ll = long long;
ll a[300007];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  ll res = 0;
  for (int i = 0; i < n; i++) res += (i + 2) * a[i];
  res -= a[n - 1];
  cout << res << endl;
}
