program sample
    implicit none
  
    integer(8) :: i,j,m,n,c,k,s
    
    integer(8),allocatable :: b(:),a(:)
  
    read(*,*) n,m,c
    allocate(b(m))
    allocate(a(m))
    read(*,*)b
    k=0
    do i=1,n
        read(*,*)a
        s=0
        do j=1,m
            s=s+a(j)*b(j)
        end do
        if (s+c>0)then
            k=k+1
        end if
    end do


    write(*,*) k  
    stop
end program sample
  

