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