number = gets.chomp.to_i # 3
ints = gets.chomp.split.map(&:to_i) # 1 2 3
ans = 0
for i in 0..(number - 2) do
  ints_tmp = ints.slice(i + 1, number - 1)
  ans += ints_tmp.sum * ints[i] % (1000000007)
end

puts ans % (1000000007)