#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, i, sum = 0, cnt = 0;
  vector<long long> pref, v;
  cin >> n;
  pref.resize(n);
  v.resize(n);
  for (i = 0; i < n; i++) {
    cin >> v[i];
    cnt += v[i];
  }
  sort(v.begin(), v.end());
  if (n == 1) {
    cout << cnt;
    return 0;
  }
  sum += cnt * 2;
  cnt -= v[0];
  for (i = 1; i < n - 1; i++) {
    sum += cnt;
    cnt -= v[i];
  }
  cout << sum;
  return 0;
}
