import sys

n = int(sys.stdin.readline())
pi = list(map(int, sys.stdin.readline().split()))

pi.sort()
result = 0

for i in range(n):
    for j in range(i+1):
        result += pi[j]

print(result)

# 0 1 2 3 4 
# 0 : 1
# 1 : 1 2 
# 2 : 1 2 3 
# 3 : 1 2 3 4
# 4 : 1 2 3 4 5
ed62f7b4c91a0ed56f6426d0359b16638c6e90cb
<mask token>

<mask token>
pi.sort()
<mask token>
for i in range(n):
    for j in range(i + 1):
        result += pi[j]
print(result)

<mask token>
n = int(sys.stdin.readline())
pi = list(map(int, sys.stdin.readline().split()))
pi.sort()
result = 0
for i in range(n):
    for j in range(i + 1):
        result += pi[j]
print(result)

import sys
n = int(sys.stdin.readline())
pi = list(map(int, sys.stdin.readline().split()))
pi.sort()
result = 0
for i in range(n):
    for j in range(i + 1):
        result += pi[j]
print(result)

import sys

n = int(sys.stdin.readline())
pi = list(map(int, sys.stdin.readline().split()))

pi.sort()
result = 0

for i in range(n):
    for j in range(i+1):
        result += pi[j]

print(result)

# 0 1 2 3 4 
# 0 : 1
# 1 : 1 2 
# 2 : 1 2 3 
# 3 : 1 2 3 4
# 4 : 1 2 3 4 5