#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  while (cin >> n) {
    int array[300005];
    long long sum = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", array + i);
      sum += array[i];
    }
    if (n == 1) {
      cout << sum << endl;
      continue;
    }
    sort(array, array + n);
    long long temp = sum;
    for (int i = 0; i < n - 1; i++) {
      sum += temp;
      temp -= array[i];
    }
    cout << sum << endl;
  }
  return 0;
}
