링크 : https://www.acmicpc.net/problem/11399
/*
문제 : ATM
링크 : https://www.acmicpc.net/problem/11399
*/
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> v;
for(int i = 0, tmp ; i < n; i++){
cin >> tmp;
v.push_back(tmp);
}
sort(v.begin(), v.end());
int tmp = 0;
int sum = 0;
for(int i : v){
tmp += i;
sum += tmp;
}
cout << sum;
}