N = gets.chomp.to_i
A = gets.split(' ').map(&:to_i)

MOD = 10 ** 9 + 7

sum = 0

(0..(N - 2)).each do |i|
    ((i + 1)..(N - 1)).each do |j|
        sum += (A[i] * A[j]) % MOD 
        sum %= MOD
    end
end

puts sum