MOD = 1_000_000_007
io = DATA.eof? ? STDIN : DATA
n=io.gets.to_i
ar=io.gets.split.map(&:to_i)
ans=0
n.times do |i|
  ((i+1)...n).each do |j|
    ans+=ar[i]*ar[j]
    ans%=MOD
  end
end
puts ans
__END__
