#include <bits/stdc++.h>
using namespace std;
clock_t time_p = clock();
void shahil_005() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
int power(long long x, long long y) {
  if (y == 0) return 1;
  long long p = power(x, y / 2);
  p = (p * p);
  return (y % 2 == 0) ? p : (x * p);
}
int lcm(long long a, long long b) {
  long long lar = max(a, b);
  long long small = min(a, b);
  for (long long i = lar;; i += lar) {
    if (i % small == 0) return i;
  }
}
int gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int bsearch(long long arr[], long long l, long long r, long long x) {
  while (l <= r) {
    long long m = l + (r - l) / 2;
    if (arr[m] == x) {
      return m;
    }
    if (arr[m] < x) {
      l = m + 1;
    } else
      r = m - 1;
  }
  return -1;
}
bool prime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
bool sortbysec(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.second < b.second);
}
bool sortbydec(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return a.first > b.first;
}
const int N = 1e5 + 5;
const long long MOD = (long long)(1e9 + 7);
const long long INIT = (long long)(1e6 + 1);
void solve() {
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (i <= n - 3) {
      ans += (a[i] * (i + 2));
    } else {
      ans += a[i] * (n);
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
