read N M C
read B

for i in $(seq $N); do
    read A
    SUM=$C
    while read X <&3 && read Y <&4; do
        SUM=$(($SUM+$X*$Y))
    done 3<<<"$(echo $A | tr ' ' '\n')" 4<<<"$(echo $B | tr ' ' '\n')"
    if [ $SUM -gt 0 ]; then
        echo OK
    fi
done | wc -l
