MOD = 10**9+7
class Problem
  attr_accessor *(?a..?z).to_a.map(&:to_sym)
  def initialize
    @n = gets.to_s.to_i
    @a = gets.split.map(&:to_i)
  end

  def solve
    ans = 0
    cs = a[0]
    1.upto(n-1) do |i|
      ans += cs * a[i]
      cs += a[i]
      ans %= MOD
      cs %= MOD
    end
    ans
  end

  def show(ans)
    puts ans
  end
end

Problem.new.instance_eval do
  show(solve)
end