Imports System

Module Program
    Sub Main(args As String())

        Dim N As Integer = Integer.Parse(Console.ReadLine())
        Dim A() As Long = Console.ReadLine().Split(" ").Select(Function(x) Long.Parse(x)).ToArray()

        For i As Integer = 0 To N - 1
            If A(i) >= 1000000007 Then
                A(i) = A(i) Mod 1000000007
            End If
        Next

        Dim ans As Integer = 0
        For i As Integer = 0 To N - 2
            For j = i + 1 To N - 1
                Dim wk As Long = A(i) * A(j)
                If wk >= 1000000007 Then
                    ans += wk Mod 1000000007
                End If
                If ans >= 1000000007 Then
                    ans = ans Mod 1000000007
                End If
            Next
        Next

        Console.WriteLine(ans)

    End Sub


End Module
