Problem:
Score : 200 points

Problem Statement

There are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.

Additionally, you are given integers B_1, B_2, ..., B_M and C.

The i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.

Among the N codes, find the number of codes that correctly solve this problem.

Constraints

All values in input are integers.

1 \leq N, M \leq 20

-100 \leq A_{ij} \leq 100

-100 \leq B_i \leq 100

-100 \leq C \leq 100

Input

Input is given from Standard Input in the following format:

N M C
B_1 B_2 ... B_M
A_{11} A_{12} ... A_{1M}
A_{21} A_{22} ... A_{2M}
\vdots
A_{N1} A_{N2} ... A_{NM}

Output

Print the number of codes among the given N codes that correctly solve this problem.

Sample Input 1

2 3 -10
1 2 3
3 2 1
1 2 2

Sample Output 1

1

Only the second code correctly solves this problem, as follows:

Since 3 \times 1 + 2 \times 2 + 1 \times 3 + (-10) = 0 \leq 0, the first code does not solve this problem.

1 \times 1 + 2 \times 2 + 2 \times 3 + (-10) = 1 > 0, the second code solves this problem.

Sample Input 2

5 2 -4
-2 5
100 41
100 40
-3 0
-6 -2
18 -13

Sample Output 2

2

Sample Input 3

3 3 0
100 -100 0
0 100 100
100 100 100
-100 100 100

Sample Output 3

0

All of them are Wrong Answer. Except yours.

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define slld(t) scanf("%lld",&t)
#define sd(t) scanf("%d",&t)
#define sc(x) scanf("%s",x)
#define pd(t) prllf("%d\n",t)
#define plld(t) prllf("%lld\n",t)
#define mp(a,b) make_pair(a,b)
#define pii pair<ll,ll> 
#define pli pair<ll,ll>
#define pil pair<ll,ll>  
#define pll pair<ll,ll>
#define ff first
#define ss second
#define pb(x) push_back(x)
#define ub upper_bound
#define lb lower_bound
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define clr(x) memset(x,0,sizeof(x))
#define sws ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define pi acos(-1)
#define rep(I, N) for (ll I = 0; I < (N); ++I)
#define repp(I, a, B) for (ll I = (a); I <= (B); ++I)
using namespace std;
#define TRACE

#ifdef TRACE
#define t(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define t(...)
#endif
string itos(ll i) 
{
    string s = "";
    while(i)
    {
        s += char(i % 10 + '0');
        i /= 10; 
    }
    reverse(all(s));  
    return s; 
}
ll stoi(string &s) 
{
    ll tot = 0; 
    for (ll i = (ll)s.length() - 1, j = 1; i >= 0; i--, j *= 10) 
    {
        tot += j * (s[i] + '0'); 
    }  
    return tot; 
}
ll gcd(ll a, ll b)
{
    if(b == 0)  return a;
     return gcd(b, a%b);
}
ll lcm(ll a, ll b)
{
    return (a*b*1LL) / gcd(a, b);
}    
/*
bool isPrime[MAX];
void sieve(ll n) 
{
    for(ll i = 0; i <= n;++i) 
    {
        isPrime[i] = true;
    }
    isPrime[0] = false;
    isPrime[1] = false;
    for(ll i = 2; i * i <= n; ++i) 
    {
         if(isPrime[i] == true) 
         {
             for(ll j = i * i; j <= n ;j += i)
                 isPrime[j] = false;
        }
    }
}*/   
ll pwr(ll base, ll p, ll mod)
{
    if(p < 0) p += mod - 1;
    ll ans = 1;
    while(p)
    {
        if(p & 1) ans = (ans * base) % mod;
        base = (base * base) % mod;
        p /= 2;
    }
    return ans;
}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

const ll N = 2e5 + 5;
const ll M = 2e5 + 5;
const ll LN = 30;
const ll BLOCK = 1000;
const ll MAX = 2e6 + 5;
const ll MOD = 1e9 + 7;


//


signed main()
{
    sws;
    srand(time(NULL));
    cout << fixed << setprecision(10);
    clock_t clk;
    clk = clock();
    

    //freopen("input.txt", "r", stdin);  freopen("input.txt", "w", stdout);


    ll n, m, c;
    cin >> n >> m >> c;
    ll brr[m + 1];
    repp(i,1,m) cin >> brr[i];
    ll arr[n + 1][m + 1];
    repp(i,1,n) 
    {
        repp(j,1,m)
        {
            cin >> arr[i][j];
        }
    }
    int ans = 0;
    repp(i,1,n)
    {
        ll sum = c;
        repp(j,1,m) 
        {
            sum += arr[i][j] * brr[j];
        }
        if(sum > 0) ans++;
    }
    cout << ans << "\n";
    

    clk = clock() - clk;
    cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
    
    return 0;
}