#include <bits/stdc++.h>
using namespace std;
long long int n, sum, res, arr[400000];
int main() {
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  sort(arr + 1, arr + n + 1);
  res += sum;
  for (long long int i = 1; i <= n - 1; i++) {
    res += sum;
    sum -= arr[i];
  }
  cout << res << endl;
}
