#include <bits/stdc++.h>

#define MAX 101

int arr[MAX];

int main() {

    int N;
    int sum, prevsum;
    while (std::cin >> N) {
        for (int i = 0; i < N; i++) std::cin >> arr[i];
        std::sort(arr, arr+N);
        sum = prevsum = 0;

        for (int i = 0; i < N; i++) {
            sum += arr[i] + prevsum;
            prevsum += arr[i];

        }

        std::cout << sum << std::endl;
    }

    return  0;


}

