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

readIntArray ()

()
|> readIntArray
|> Array.indexed
|> fun arr ->
    [ for (i1, v1) in arr do
        if i1 < (arr |> Array.length |> (-) <| 1) then
            for (_, v2) in arr.[i1 + 1..] do
                v1 * v2 ]
    |> List.sum
    |> (%)
    <| 1000000007L
    |> printfn "%d"
