#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int n, i, x;
  cin >> n;
  int arr[n];
  long long ans = 0;
  for (i = 0; i < n; ++i) {
    cin >> arr[i];
    ans += arr[i];
  }
  long long dif = 0, ans1 = ans;
  sort(arr, arr + n);
  for (i = 0; i < n; ++i) {
    ans1 = ans1 + ans;
    ans = ans - arr[i];
  }
  cout << ans1 - arr[n - 1] << endl;
  return 0;
}
