#include <fstream>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <deque>
using namespace std;
const char infile[] = "regiuni.in";
const char outfile[] = "regiuni.out";
ifstream fin(infile);
ofstream fout(outfile);
const int MAXN = 1010;
const int oo = 0x3f3f3f3f;
typedef vector<int> Graph[MAXN];
typedef vector<int> :: iterator It;
const inline int min(const int &a, const int &b) { if( a > b ) return b; return a; }
const inline int max(const int &a, const int &b) { if( a < b ) return b; return a; }
const inline void Get_min(int &a, const int b) { if( a > b ) a = b; }
const inline void Get_max(int &a, const int b) { if( a < b ) a = b; }
int main() {
int N, M;
fin >> N >> M;
vector <int> a(N), b(N), c(N);
vector <unsigned int> Hash(M);
for(int i = 0 ; i < N ; ++ i)
fin >> a[i] >> b[i] >> c[i];
for(int i = 0 ; i < M ; ++ i) {
int x, y;
fin >> x >> y;
for(int j = 0 ; j < N ; ++ j) {
bool sign = ((a[j] * x + b[j] * y + c[j]) > 0);
Hash[i] = (Hash[i] << 1) + sign;
}
}
int Ans = 0;
for(int i = 0 ; i < M ; ++ i) {
bool alone = true;
for(int j = 0 ; j < i && alone ; ++ j)
alone ^= (Hash[i] == Hash[j]);
Ans += alone;
}
fout << Ans << '\n';
fin.close();
fout.close();
return 0;
}