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

int main() {
  int n,t;
  while(cin>>n) {
    vector<int> v;
    for(int i=0; i<n; ++i) {
      cin>>t;
      v.push_back(t);
    }
    sort(v.begin(), v.end());
    int pena = 0,sum = 0;
    for(int i=0; i<n; ++i) {
      sum += v[i];
      pena += sum;
    }
    cout<<pena<<endl;
  }
}