#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N;
scanf("%d", &N);
vector<int> times(N);
for (int i = 0; i < N; ++i) {
scanf("%d", ×[i]);
}
sort(times.begin(), times.end());
int tot_time = 0;
int acc_time = 0;
for (int i = 0; i < N; ++i) {
acc_time += times[i];
tot_time += acc_time;
}
printf("%d\n", tot_time);
return 0;
}