N=int(input()) print(sum([(2*num-N-1)*i for num, i in enumerate(list(map(int, input().split())), start = 1)]))