#include <bits/stdc++.h>
using namespace std;
ifstream f("regiuni.in");
ofstream g("regiuni.out");
map<string,bool>regiuni;
int ndrepte, npuncte;
struct punct{
double x, y;
}puncte[1005];
struct dreapta{
double a, b, c;
punct pst, pdr;
void create_pct()
{
if (b==0)
{
pst.x=pdr.x=(-c)/a;
pst.y=0;
pdr.y=10;
}
else{
pst.x=0;
pst.y=(-c)/b;
pdr.x=10;
pdr.y=((-c)-10*a)/b;
}
}
}drepte[1005];
double determinant(punct a, punct b, punct c)
{
return a.x*b.y+b.x*c.y+c.x*a.y-a.y*b.x-b.y*c.x-c.y*a.x;
}
void adaugare_pct(punct p)
{
string s="";
for (int i=1; i<=ndrepte; ++i)
{
if(determinant(drepte[i].pst,p,drepte[i].pdr)>0)
s.push_back('1');
else
s.push_back('0');
}
regiuni[s]=true;
}
int main()
{
f >> ndrepte >> npuncte;
for (int i=1; i<=ndrepte; ++i)
{
f >> drepte[i].a >> drepte[i].b >> drepte[i].c;
drepte[i].create_pct();
}
for(int i=1; i<=npuncte; ++i)
{
f >> puncte[i].x >> puncte[i].y;
adaugare_pct(puncte[i]);
}
int nr=0;
for (auto it:regiuni)
nr++;
g << nr;
return 0;
}