N = gets.chomp.to_i
mod = (10**9 + 7)
ary = gets.chomp.split(" ").map(&:to_i).map { |x| x % mod }
amari = []

ary.each_with_index do |a,i|
  j = i + 1
  while j <= (ary.length - 1) do
    one = (a * ary[j]) % mod
    amari << one
    j += 1
  end
end

puts (amari.sum ) % mod