program main
implicit none
integer :: n, m, c, nc, s
integer , allocatable :: a( :, : ), b( : )

read(*,*) n, m, c
allocate( a(n,m) )
allocate( b(m) )
read(*,*) b(1:m)
nc = 0
do i = 1, n
   read(*,*) a(i,1:m)
   s = 0
   do j = 1, m
      s = s + a(i,j)*b(j)
   end do
   if( s+c > 0) then
      nc = nc + 1
   end if
end do
write(*,'(i0)') nc

end program main
