11399번 ATM
import sys N = int(sys.stdin.readline()) P = list(map(int, sys.stdin.readline().split())) P.sort() val = 0 result = 0 for i in range(N): val += P[i] result += val print(result)