/// moving to stdio
#include <stdio.h>
#include <vector>
using namespace std;
vector <short> a, b, c;
vector <double> Hash;
short x, y, N, M, Ans;
bool alone, sign;
int main() {
freopen("regiuni.in", "r", stdin);
freopen("regiuni.out", "w", stdout);
scanf("%hd %hd", &N, &M);
a.reserve(N);
b.reserve(N);
c.reserve(N);
Hash.reserve(M);
for(short i = 0 ; i < N ; ++ i)
scanf("%hd %hd %hd", &a[i], &b[i], &c[i]);
for(short i = 0 ; i < M ; ++ i) {
scanf("%hd %hd", &x, &y);
for(short j = 0 ; j < N ; ++ j) {
sign = ((a[j] * x + b[j] * y + c[j]) > 0);
Hash[i] = ((Hash[i] * 0.2564) + sign) ;
}
}
for(short i = 0 ; i < M ; ++ i) {
alone = true;
for(short j = 0 ; j < i && alone ; ++ j)
if(Hash[i] == Hash[j])
alone = false;
Ans += alone;
}
printf("%hd\n", Ans);
return 0;
}