n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i)
sq_sum = 0
prime = (10**9) + 7
sum = 0
arr.each do |num|
    sum += num
    sum %= prime
    sq_single = (num**2) % prime
    sq_sum += sq_single
    sq_sum %= prime
end
sq = (sum ** 2) % prime
if sq - sq_sum < 0
    puts (sq - sq_sum + prime)/2
else
    puts ((sq - sq_sum)/ 2 ) % prime
end