N, M, C = list(map(int, input().split()))

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

A = [list(map(int, input().split())) for i in range(N)]



ct = 0

for i in A:

    if sum([j * k for j, k in zip(i, B)]) + C > 0:

        ct += 1



print(ct)

N, M, C = list(map(int, input().split()))

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



ct = 0

for i in range(N):

    if sum([j * k for j, k in zip(list(map(int, input().split())), B)]) + C > 0:

        ct += 1



print(ct)

N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
ct = 0
for i in A:
    if sum([j * k for j, k in zip(i, B)]) + C > 0:
        ct += 1
print(ct)

N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
ct = 0
for i in range(N):
    if sum([j * k for j, k in zip(list(map(int, input().split())), B)]) + C > 0:
        ct += 1
print(ct)

-A = [list(map(int, input().split())) for i in range(N)] -for i in A: -    if sum([j * k for j, k in zip(i, B)]) + C > 0: +for i in range(N): +    if sum([j * k for j, k in zip(list(map(int, input().split())), B)]) + C > 0: