lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]
Mod = 10 ** 9 + 7

sum = 0
for i in 1..N do
  sum += lines[1][i-1]
end

sum_sc = 0
for i in 1..N do
  sum_sc += lines[1][i-1] ** 2
end

puts ((sum ** 2 - sum_sc) / 2) % Mod