import Enum
import Integer

defmodule Main do
  @pow1097  1000000007
  def sum_of_pair(n,seq) do
    list = for x <- Enum.to_list(0..n-2), y <- Enum.to_list(x+1..n-1),do: rem(Enum.at(seq,x)*Enum.at(seq,y),@pow1097)
    res = reduce1097(list)
  end
  
  def  pow(n, k), do: pow(n, k, 1)        
  defp pow(_, 0, acc), do: acc
  defp pow(n, k, acc), do: pow(n, k - 1, n * acc)
  
  def reduce1097(list), do: reduce1097(list,0)
  defp reduce1097([],acc), do: acc
  defp reduce1097([head|tail],acc), do: reduce1097(tail,rem(head+acc,@pow1097))

 def main do
    n = IO.gets("") |> String.trim() |> String.to_integer
    seq = IO.read(:line) |> String.trim() |> String.split(" ") |> map(&String.to_integer/1)
    IO.inspect sum_of_pair(n,seq)
 end
end