defmodule Main do
  def main() do
    n = IO.gets("") |> String.trim() |> String.to_integer()
    a = IO.gets("") |> String.trim() |> String.split(" ") |> Enum.map(&String.to_integer(&1))

    Enum.map(0..n-2, fn x ->
      Enum.map(Enum.slice(a, x+1..-1), fn y -> y*Enum.at(a,x) end)
      |> Enum.sum()
    end)
    |> Enum.sum()
    |> Integer.mod(1000000007)
    |> IO.puts()
  end
end
