#include<iostream>
#include<set>
using namespace std;
int main()
{
  int n,t,sum,time;
  while(cin>>n){
    multiset<int>ms;
    multiset<int>::iterator it;
    while(n-->0){
      cin>>t;
      ms.insert(t);
    }
    sum=time=0;
    for(it=ms.begin();it!=ms.end();it++){
      time+=*it;
      sum+=time;
    }
    cout<<sum<<endl;
  }
}