#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300010;
long long int d[MAXN], a[MAXN];
long long int answer;
long long int solve(long long int s, long long int e) {
  if (s > e) {
    return 0;
  }
  if (s == e) {
    return a[s];
  }
  long long int curr = d[e] - d[s] + a[s];
  int mid = (e + s) / 2;
  if ((e + s) % 2 == 1) {
    mid++;
  }
  return curr + solve(s, mid - 1) + solve(mid, e);
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  d[0] = a[0];
  for (int i = 1; i < n; i++) {
    d[i] = d[i - 1] + a[i];
  }
  long long int answer = 0;
  for (int i = 0; i < n; i++) {
    answer += d[n - 1] - d[i] + a[i];
  }
  for (int i = 0; i < n - 1; i++) {
    answer += a[i];
  }
  cout << answer << endl;
}
