N = int(input()) A = list(map(int, input().split())) A.sort(reverse=True) n = 0 for i in range(N): n += (A[i]+1) * (N-1-i) print(n)