#!/usr/bin/env ruby
# require 'pry'

# dpテンプレ

n = gets.chomp.split('')
a = gets.split(' ').map(&:to_i)
sum = 0
a.map.with_index { |e,i|
  (i+1).upto(a.length-1) { |j|
    sum += a[i] * a[j]
  }
}
puts sum % (10**9 + 7)