#include <bits/stdc++.h>
using namespace std;
long long INF = (1LL << 62);
const int inf = (1LL << 30);
const int maxn = (int)1e6 + 5;
const int MOD = 1000000007;
using namespace std;
int arr[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  int N;
  cin >> N;
  for (int i = 0; i < N; ++i) cin >> arr[i];
  if (N == 1) {
    cout << arr[0] << endl;
    return 0;
  }
  sort(arr, arr + N);
  reverse(arr, arr + N);
  long long sum = 0;
  for (int i = 0; i < N; ++i) sum += arr[i];
  long long ans = sum;
  long long gone = 0;
  for (int i = 0; i < N - 1; ++i) {
    ans += (sum - gone);
    gone += arr[N - i - 1];
  }
  cout << ans << endl;
  return 0;
}
