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