import numpy as np

N = int(input())
vn_list = input().split()

vn = np.sort(np.array(vn_list, dtype="float"))[::-1]
print(vn)
w = np.logspace(1, N, base=1/2, num = N)
w[N-1] = w[N-2]
result = np.dot(vn, w)
print(result)