number = gets.chomp.to_i # 3
ints = gets.chomp.split.map(&:to_i) # 1 2 3
for a in 0..(number - 1) do
  ints[a] = ints[a] % 1000000007
end

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