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

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

ans = 0

for _ in range(n):

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

    res = c

    for i in range(m):

        res += b[i]*a[i]

    if res > 0:

        ans += 1

print(ans)
N,M,D = list(map(int,input().split()))



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



ans = 0



for _ in range(N):

    tmp_math = D

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

    for i in range(M):

        tmp_math += B[i]*A[i]

    if tmp_math > 0:

        ans += 1

print(ans)
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for _ in range(n):
    a = list(map(int, input().split()))
    res = c
    for i in range(m):
        res += b[i] * a[i]
    if res > 0:
        ans += 1
print(ans)

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

-n, m, c = list(map(int, input().split())) -b = list(map(int, input().split())) +N, M, D = list(map(int, input().split())) +B = list(map(int, input().split())) -for _ in range(n): -    a = list(map(int, input().split())) -    res = c -    for i in range(m): -        res += b[i] * a[i] -    if res > 0: +for _ in range(N): +    tmp_math = D +    A = list(map(int, input().split())) +    for i in range(M): +        tmp_math += B[i] * A[i] +    if tmp_math > 0: