import numpy as np



n, m, c = list(map(int, input().split()))

b = np.array(list(map(int, input().split())))

ans = []

for i in range(n):

    a = np.array(list(map(int, input().split())))

    if b.dot(a)+c > 0:

        ans.append(i+1)

print((len(ans)))

n, m, c = list(map(int, input().split()))

b_l = list(map(int, input().split()))

ans = []

for i in range(n):

    a_l = list(map(int, input().split()))

    if sum(a*b for a, b in zip(a_l, b_l)) + c > 0:

        ans.append(i)

print((len(ans)))

import numpy as np

n, m, c = list(map(int, input().split()))
b = np.array(list(map(int, input().split())))
ans = []
for i in range(n):
    a = np.array(list(map(int, input().split())))
    if b.dot(a) + c > 0:
        ans.append(i + 1)
print((len(ans)))

n, m, c = list(map(int, input().split()))
b_l = list(map(int, input().split()))
ans = []
for i in range(n):
    a_l = list(map(int, input().split()))
    if sum(a * b for a, b in zip(a_l, b_l)) + c > 0:
        ans.append(i)
print((len(ans)))

-import numpy as np - -b = np.array(list(map(int, input().split()))) +b_l = list(map(int, input().split())) -    a = np.array(list(map(int, input().split()))) -    if b.dot(a) + c > 0: -        ans.append(i + 1) +    a_l = list(map(int, input().split())) +    if sum(a * b for a, b in zip(a_l, b_l)) + c > 0: +        ans.append(i)