// Last Change: 11/14/2019 18:38:01.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

void solve(ll N) {
  vector<ll> P(N);
  for (auto &&e : P) {
    cin >> e;
  }
  sort(P.begin(), P.end());
  ll res, temp;
  res = temp = 0;
  for (auto &&e : P) {
    temp += e;
    res += temp;
  }
  cout << res << endl;
}

int main() {
  ll N;
  while (cin >> N) {
    solve(N);
  }
}

