unittest
{
	assert( [ "2 3 -10", "1 2 3", "3 2 1", "1 2 2" ].parse.expand.solve == 1 );
	assert( [ "5 2 -4", "-2 5", "100 41", "100 40", "-3 0", "-6 -2", "18 -13" ].parse.expand.solve == 2 );
	assert( [ "3 3 0", "100 -100 0", "0 100 100", "100 100 100", "-100 100 100" ].parse.expand.solve == 0 );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nmc = input.front.split.to!( long[] );
	input.popFront;
	auto bs = input.front.split.to!( long[] );
	auto ass = new long[][]( nmc[ 0 ], nmc[ 1 ] );
	foreach( ref as; ass )
	{
		input.popFront;
		as = input.front.split.to!( long[] );
	}
	return tuple( nmc[ 2 ], bs, ass );
}

auto solve( long c, long[] bs, long[][] ass )
{
	auto ans = 0L;
	
	foreach( as; ass )
	{
		auto s = 0L;
		foreach( a, b; lockstep( as, bs ) )
		{
			s += a * b;
		}
		ans += ( 0 < s + c );
	}
	
	return ans;
}
