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()

        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 < 10 ^ 9 + 7 Then
                    ans += wk
                Else
                    ans += wk Mod (10 ^ 9 + 7)
                    If ans >= 10 ^ 9 + 7 Then
                        ans = ans Mod (10 ^ 9 + 7)
                    End If
                End If
            Next
        Next

        Console.WriteLine(ans)

    End Sub

End Module
