let readIntArray () =
    stdin.ReadLine().Split(" ") |> Array.map int64

readIntArray ()

()
|> readIntArray
|> Array.indexed
|> fun arr ->
    seq {
        for (i1, v1) in arr do
            if i1 < (arr |> Array.length |> (-) <| 1) then
                for (_, v2) in arr.[i1 + 1..] do
                    v1 * v2 % 1000000007L
    }
    |> Seq.reduce (fun a b -> (a + b) % 1000000007L)
    |> printfn "%d"
