#include <bits/stdc++.h>
using namespace std;
#pragma GCC diagnostic ignored "-Wformat"
template <typename T>
void printContainer(T& a) {
  auto it = a.begin();
  cout << "{" << *(it++);
  for (; it != a.end(); ++it) cout << ", " << (*it);
  cout << "}\n";
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (int)(n); ++i) cin >> a[i];
  sort((a).begin(), (a).end());
  reverse((a).begin(), (a).end());
  long long res = 0;
  vector<long long> sum(n);
  sum[0] = a[0];
  for (int i = 1; i < (n); ++i) sum[i] = sum[i - 1] + a[i];
  res = sum[n - 1];
  for (int len = n; len > 1; --len) res += sum[len - 1];
  cout << res << endl;
}
