#include <bits/stdc++.h>
using namespace std;
void quicksort(long long a[], long long left, long long right);
long long a[3000005], b[3000005];
int main() {
  long long n, sum = 0, x = 1, sum1 = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  quicksort(a, 1, n);
  for (int i = 1; i <= n; i++) {
    sum = sum + a[i];
  }
  b[x] = sum;
  x++;
  for (int i = 1; i <= n; i++) {
    sum = sum - a[i];
    b[x] = sum;
    x++;
  }
  for (int i = 1; i < x; i++) {
    sum1 = sum1 + b[i];
  }
  for (int i = 1; i < n; i++) {
    sum1 = sum1 + a[i];
  }
  cout << sum1;
}
void quicksort(long long a[], long long left, long long right) {
  int i, j, x, tmp;
  if (left > right) return;
  x = a[(left + right) / 2];
  i = left;
  j = right;
  do {
    while (a[i] < x) i++;
    while (a[j] > x) j--;
    if (i <= j) {
      tmp = a[i];
      a[i] = a[j];
      a[j] = tmp;
      i++;
      j--;
    }
  } while (i < j);
  if (left < j) quicksort(a, left, j);
  if (i < right) quicksort(a, i, right);
}
