#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  bool first = true;
  os << "[";
  for (unsigned int i = 0; i < v.size(); i++) {
    if (!first) os << ", ";
    os << v[i];
    first = false;
  }
  return os << "]";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::set<T>& v) {
  bool first = true;
  os << "[";
  for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "]";
}
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::map<T1, T2>& v) {
  bool first = true;
  os << "[";
  for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "]";
}
template <typename T>
string ToString(T Number) {
  ostringstream ss;
  ss << Number;
  return ss.str();
}
int main() {
  int temp, n, t;
  vector<int> a;
  cin >> n;
  temp = n;
  int si = 0;
  long long tscore = 0, score = 0;
  while (temp--) {
    cin >> t;
    a.push_back(t);
    tscore += t;
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    si = i;
    if (i == 0) {
      score += tscore;
      continue;
    }
    score += tscore;
    tscore -= a[i - 1];
    if (n - si <= 1) break;
  }
  cout << score << endl;
  return 0;
}
