#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
const long long mod = (1e9) + 7;
void solve() {
  long long n, i, ans = 0, sum = 0;
  cin >> n;
  vector<int> a(n);
  for (i = 0; i < n; i++) cin >> a[i], sum += a[i];
  sort(a.begin(), a.end());
  for (i = 0; i < n; i++) {
    ans += sum;
    if (i + 1 != n) ans += a[i];
    sum -= a[i];
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
