#include <stdio.h>
#include <stdlib.h>

#define N 128
#define INT(X) \
  ( *( (const int *)(X) ) )

int comparator (
  const void  * a,
  const void  * b
  )
{
  return ( INT( a ) - INT( b ) );
}

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int i;
  int n;

  while ( scanf ( "%d", &n ) == 1 )
  {
    int res = 0;
    int d[ N ];

    for ( i = 0; i < n; ++i )
    {
      scanf ( "%d", d + i );
    }
    qsort ( d, n, sizeof ( int ), comparator );

    for ( i = 1; i < n; ++i )
    {
      d[ i ] += d[ i - 1 ];
    }
    for ( i = 0; i < n; ++i )
    {
      res    += d[ i ];
    }

    printf ( "%d\n", res );
  }

  return ( 0 );
}