#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  long long sum = 0;
  cin >> n;
  int a[n + 10];
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  if (n == 1) {
    cout << a[1];
    return 0;
  }
  sort(a + 1, a + n + 1);
  int l = 1;
  long long s = sum, s1 = sum;
  while (l != n - 1) {
    sum = sum + (s - a[l]);
    s -= a[l];
    l++;
  }
  cout << sum + s1;
}
