#include <bits/stdc++.h>
using namespace std;
template <typename TYPE>
inline TYPE sqr(const TYPE& a) {
  return a * a;
}
const long double EPS = 1e-9;
const long double PI = 2 * acos(0.0);
const int N = 300010;
int a[N];
int main() {
  int n;
  scanf("%d", &n);
  long long s = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    s += a[i];
  }
  sort(a, a + n);
  long long ans = s;
  for (int i = 0; i + 1 < n; ++i) {
    ans += s;
    s -= a[i];
  }
  cout << ans << endl;
  return 0;
}
