#include <stdio.h>

int main(void)
{
    int N;
    int time[100];
    int sum1, sum2;
    int i, j;
    int t;
    
    while (scanf("%d", &N) != EOF){
        for (i = 0; i < N; i++){
            scanf("%d", &time[i]);
        }
        for (i = 0; i < N; i++){
            for (j = 0; j < N - 1; j++){
                if (time[j] > time[j + 1]){
                    t = time[j];
                    time[j] = time[j + 1];
                    time[j + 1] = t;
                }
            }
        }

        sum1 = sum2 = 0;
        for (i = 0; i < N; i++){
//printf("[%d]", time[i]);
            sum1 += time[i];
            sum2 += sum1;
        }
        
        printf("%d\n", sum2);
    }
    return (0);
}