let N = Int(readLine()!)! let P = readLine()!.split(separator: " ").map{ Int(String($0))! }.sorted() var sumArr = [P[0]] for i in 1..<N { sumArr.append(sumArr[i-1] + P[i]) } print(sumArr.reduce(0, +))