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

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

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



cnt=0

for i in range(N):

    ans=0

    for j in range(M):

        ans += B[j]*A[i][j]

    if ans+C>0:

        cnt+=1



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

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

cnt=0

for i in range(N):

    am=0

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

    for j in range(M):

        am+=B[j]*A[j]

    if am+C>0:

        cnt+=1

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

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

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