n = int(input()) a = list(map(int,input().split())) ans = 0 for i in a: ans += i * sum([i**(x-1) for x in a]) print(ans)