program abc121b
  integer n, m, c, i, ans
  integer, allocatable :: a(:), b(:)
  read *, n, m, c
  allocate(a(m), b(m))
  read *, b
  ans = 0
  do i = 1, n
     read *, a
     if (dot_product(a, b) + c > 0) ans = ans + 1
  end do
  print *, ans
end program abc121b
