#!/usr/bin/env ruby
# require 'pry'

# dpテンプレ

n = gets.chomp.to_i
a = gets.split(' ').map(&:to_i)
sum = 0

(n-1).times do |i|
  a_i = a[0]
  a.slice!(0)
  ruiseki = a.sum
  sum += a_i * ruiseki
end

puts sum % (10**9 + 7)