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

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



cnt=0

for i in range(n):

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

  total=0

  for a_,b_ in zip(a,b):

    total+=a_*b_

  if 0 < total+c:

    cnt+=1

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

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



def prod(a,b,init=0):

  total=init

  for a_,b_ in zip(a,b):

    total+=a_*b_  

  return total



cnt=0

for i in range(n):

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

  if 0 < prod(a,b,init=c):

    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):
    a = list(map(int, input().split()))
    total = 0
    for a_, b_ in zip(a, b):
        total += a_ * b_
    if 0 < total + c:
        cnt += 1
print(cnt)

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


def prod(a, b, init=0):
    total = init
    for a_, b_ in zip(a, b):
        total += a_ * b_
    return total


cnt = 0
for i in range(n):
    a = list(map(int, input().split()))
    if 0 < prod(a, b, init=c):
        cnt += 1
print(cnt)

+ + +def prod(a, b, init=0): +    total = init +    for a_, b_ in zip(a, b): +        total += a_ * b_ +    return total + + -    total = 0 -    for a_, b_ in zip(a, b): -        total += a_ * b_ -    if 0 < total + c: +    if 0 < prod(a, b, init=c):