program baisuu_search
    integer(8) :: K, i
    integer :: a(7)

    read *, K
    a(1) = mod(7,K)
    do i = 2 , K
        a(i) = (a(i-1)*10+7)
    end do
    do i = 1,K
        if(a(i)==0)then
            print *, i
        else if(i == K)then
            print *, '-1'
        end if
    end do
end program