n = gets.chomp.to_i
arr = gets.chomp.split

sum = 0
(0..n-2).each do |i|
    (i+1..n-1).each do |j|
        sum += arr[i].to_i * arr[j].to_i
    end
    sum %= (10 ** 9 + 7)
end
puts sum % (10 ** 9 + 7)
