#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> v;
const int N = 1e9;
const double EPS = 1e-8;
long long int arr[301000];
int main() {
  long long int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  long long int c = 0;
  for (int i = 0; i < n; i++) {
    c += arr[i] * (i + 2);
  }
  c -= arr[n - 1];
  cout << c;
  return 0;
}
