N = gets.to_i A = gets.split.map(&:to_i) ans = 0 A.each_with_index do |a, idx| ans += (idx + 1) * (N - idx) * a end puts ans