#include <bits/stdc++.h>
using namespace std;
int main() {
  int x;
  cin >> x;
  int a[x];
  long long counter = 0, sum = 0;
  for (int i = 0; i < x; i++) {
    cin >> a[i];
    sum += a[i];
  }
  counter = sum;
  sort(a, a + x);
  for (int i = 0; i < x - 1; i++) {
    sum -= a[i];
    counter += (sum);
    counter += a[i];
  }
  cout << counter;
  return 0;
}
