#include<stdio.h>
int main()
{
    int a[10800],sum = 0, result = 0, i, test, j, temp;

    while( scanf("%d",&test) != EOF )
    {

        for( i = 0; i < test; i++ )
        {
            scanf("%d", &a[i]);
        }
        for( i = 0; i < test; i++ )
        {
            for( j = 0; j < test; j++ )
            {
                if( a[i] < a[j] )
                {
                    temp = a[i];
                    a[i] = a[j];
                    a[j] = temp;
                }
            }
        }

        sum = result = 0;

        for( i = 0; i < test; i++ )
        {
            sum = sum + a[i];
            result = result + sum;
        }
        printf("%d\n", result);

    }
    return 0;
}