inputs = Array.new
while line = $stdin.gets
  inputs << line.chomp
end

n = inputs[0].to_i
a = inputs[1].split().map{|s| s.to_i }

# p [n, a]

mod = 1000000007

x1 = a.map{ |a| a*a }.inject(&:+)
x2 = a.inject(&:+)
x2 = x2 * x2

ans = (x2 - x1) / 2
ans %= mod

puts ans
