#include <bits/stdc++.h>
using namespace std;
const int maxn = 3 * 100000;
typedef int mang[maxn + 10];
mang a;
int n;
long long t, tong;
int main() {
  scanf("%i", &n);
  tong = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%i", &a[i]);
    tong += a[i];
  }
  sort(a + 1, a + n + 1);
  t = tong;
  for (int i = 1; i < n; i++) t += tong, tong -= a[i];
  cout << t;
}
