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
                ans += (A(i) * A(j)) Mod (10 ^ 9 + 7)
                ans = ans Mod (10 ^ 9 + 7)
            Next
        Next

        Console.WriteLine(ans)

    End Sub


End Module
