#include <bits/stdc++.h>
using namespace std;
const int N = 3 * 1e5 + 10;
long long res;
long long a[N];
void solve() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    res += a[i];
  }
  sort(a, a + n);
  for (int i = 0; i < n; ++i) {
    res += a[i] * (i + 1);
  }
  cout << res - a[n - 1];
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
