MOD = 10**9 + 7
#puts MOD
count = gets.to_i
numbers = gets.chomp.split.map(&:to_i)

result = 0
count.times do
  current = numbers.shift
  sum = 0 
  numbers.each do |n|
    sum += current * n % MOD
  end

  result += sum
end
  
puts result % MOD
