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