#include <bits/stdc++.h>
using namespace std;
int n;
int ar[300005];
long long res;
long long sum;
int main() {
  int i, j, t, tc = 1, a, b;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> ar[i];
    sum += ar[i];
  }
  sort(ar, ar + n);
  res = sum;
  for (i = 0; i < n - 1; i++) {
    long long r1, r2;
    res += (ar[i]);
    res += (sum - ar[i]);
    sum = sum - ar[i];
  }
  cout << res << endl;
  return 0;
}
