from functools import reduce



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

bs = tuple(map(int, input().split()))



count = 0

for i in range(n):

    if reduce(

        lambda x, y: x + y[0] * y[1],

        list(zip(bs, list(map(int, input().split())))),

        0,

    ) + c > 0:

        count += 1



print(count)

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

bs = tuple(map(int, input().split()))



count = 0

for _ in range(n):

    if sum(x * bs[i] for i, x in enumerate(map(int, input().split()))) + c > 0:

        count += 1



print(count)

from functools import reduce

n, _, c = list(map(int, input().split()))
bs = tuple(map(int, input().split()))
count = 0
for i in range(n):
    if (
        reduce(
            lambda x, y: x + y[0] * y[1],
            list(zip(bs, list(map(int, input().split())))),
            0,
        )
        + c
        > 0
    ):
        count += 1
print(count)

n, _, c = list(map(int, input().split()))
bs = tuple(map(int, input().split()))
count = 0
for _ in range(n):
    if sum(x * bs[i] for i, x in enumerate(map(int, input().split()))) + c > 0:
        count += 1
print(count)

-from functools import reduce - -for i in range(n): -    if ( -        reduce( -            lambda x, y: x + y[0] * y[1], -            list(zip(bs, list(map(int, input().split())))), -            0, -        ) -        + c -        > 0 -    ): +for _ in range(n): +    if sum(x * bs[i] for i, x in enumerate(map(int, input().split()))) + c > 0: