#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int N;
    while (cin >> N) {
        vector<int> v(N);
        for (int i=0; i<N; ++i) cin >> v[i];
        sort(v.begin(), v.end());
        int score = v[0];
        for (int i=1; i<N; ++i) {
            v[i] += v[i-1];
            score += v[i];
        }
        cout << score << endl;
    }
    return 0;
}