#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1000;
int a[N];
int n;
long long sum;
long long res = 0;
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += 1ll * a[i];
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    res += sum;
    sum -= 1ll * a[i];
    res += 1ll * a[i];
  }
  cout << res - 1ll * a[n - 1] << endl;
  return 0;
}
