#include <bits/stdc++.h>
using namespace std;
vector<long long> num;
long long n, x, ans, sum;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    num.push_back(x);
    sum += x;
  }
  ans = sum;
  sort(num.begin(), num.end());
  for (int i = 0; i < num.size() - 1; i++) {
    ans += num[i] + (sum - num[i]);
    sum -= num[i];
  }
  cout << ans << endl;
}
