#include <bits/stdc++.h>
using namespace std;
int a[300300];
int main() {
  int n;
  cin >> n;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  sort(a, a + n);
  long long sum1 = 0;
  long long ans = 0;
  ans += sum;
  for (int i = 0; i < n - 1; i++) {
    ans += a[i];
    sum1 += a[i];
    ans += (sum - sum1);
  }
  cout << ans;
}
