N = int(input())
lines = list(map(int, input().split()))
lines = sorted(lines)
_sum = 0
times = []
for num in lines:
    _sum = _sum + num
    times.append(_sum)
print (sum(times))

+ Recent posts