program sum_of_product
    implicit none
    integer(8) n, i, j, b, ans, sum
    integer(8),allocatable :: a(:)

    read *, n
    allocate(a(n))
    read *, a
    sum=0

    if(2<=n .or. n<=200000)then
        do i=1,n-1
            do j=i+1,n
                if(i<j)then
                    if(j<=n)then
                        b=a(i)*a(j)
                        sum=sum+b
                    end if
                end if
            end do
        end do
    end if
    ans=mod(sum,1000000007)
    print *,ans
end program sum_of_product