require 'pp'

MOD = 10 ** 9 + 7
n = gets.to_i
a_n = gets.split.map(&:to_i)

sum = 0
0.upto(n-2) do |i|
    (i+1).upto(n-1) do |j|
        sum = (sum + (a_n[i] * a_n[j] % MOD)) % MOD
    end
end

puts sum
