#include <bits/stdc++.h>
int64_t psum[300010];
int a[300010];
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  std::sort(a, a + n);
  psum[0] = a[0];
  for (int i = 1; i < n; ++i) {
    psum[i] = a[i] + psum[i - 1];
  }
  int64_t total = psum[n - 1];
  for (int i = 0; i < n - 1; ++i) {
    total += (psum[n - 1] - (i > 0 ? psum[i - 1] : 0));
  }
  std::cout << total << '\n';
  return 0;
}
