import sys
from collections import deque
N = int(input())
person_time = list(map(int, sys.stdin.readline()[:-1].split()))
person_time.sort()
result = [0 for _ in range(N)]
for i in range(1, N + 1):
result.append(sum(person_time[:i]))
print(sum(result))