def main
  delicious_degrees = []

  object_count = gets().to_i

  return_flg = false
  gets.split(" ").each do |value|
    value.to_i >= 0 ? delicious_degrees << value.to_i : return_flg = true
    next if return_flg
  end

  return if object_count < 2 || object_count > 50
  return if return_flg

  total_delicious_value = 0
  delicious_degrees.each_with_index do |degree, index|
    next if index == object_count
    total_delicious_value += total_of_multiplication( degree, delicious_degrees[index+1..object_count] )
    # p "#{index}要素目 値:#{degree} 合計:#{total_delicious_value}"
  end
  
  p total_delicious_value
end

def total_of_multiplication( coefficient, targets )
  total = 0
  targets.each do |v|
    total += coefficient * v
  end
  total
end

main