program Spp
    implicit none
    integer(8) a, n, i, j
    integer(8) :: ans = 0
    read *, n
    read *, a
    do i = 1, n-1
        do j = i+1, n
            if(i<j)then
                ans = ans + i * j
            end if
        end do
    end do
    ans = mod(ans, 7+10**9)
    print *, ans
end program