#include <iostream>
#include <complex>
#include <vector>
#include <cmath>
#include <queue>
using namespace std;

#define EPS 1e-10
typedef complex<double> P;

struct L : public vector<P>
{
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};

struct C
{
	P p; double r;
	C(const P &p, double r) 
	:p(p),r(r) 
	{}
};

double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}

double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}

double dist(const P& a, const P& b)
{
	return sqrt((a.real()-b.real())*(a.real()-b.real())+(a.imag()-b.imag())*(a.imag()-b.imag()));
}

bool intersectSC(const L& l, const C& c)
{	
	double vc=dot(l[1]-l[0], c.p-l[0]);
	if(vc+EPS<0)
	{
		return dist(l[0], c.p)<c.r;
	}
	
	double vv=dot(l[1]-l[0], l[1]-l[0]);
	
	if(vc > vv)
	{
		double d=dist(l[1], c.p);
		
		return d*d<c.r*c.r;
	}
	
	double cc=dot(c.p-l[0], c.p-l[0]);
	
	return cc-(vc/vv)*vc < c.r*c.r;
}

int T;

class UFO
{
public:
	double v,d,dx,dy,x,y,r;
	UFO(double v, double d, double dx, double dy, double x, double y, double r)
	:v(v),d(d),dx(dx),dy(dy),x(x),y(y),r(r)
	{}
	
	bool operator<(const UFO& u) const
	{
		return d-v*T>u.d-u.v*T;
	}
};

int main()
{
	int R,N;
	while(cin >> R >> N,(R||N))
	{
		T=1;
		priority_queue<UFO> q;
		while(N--)
		{
			double x,y,r,v;
			cin >> x >> y >> r >> v;
			double d=sqrt(x*x+y*y), dx=v*x/d, dy=v*y/d;
			q.push(UFO(v,d,dx,dy,x,y,r));
		}
		
		int cnt=0;
		while(!q.empty())
		{
			UFO u=q.top(); q.pop();
			if(u.d-u.v*T < R+EPS)
			{
				cnt++;
				continue;
			}
			
			priority_queue<UFO> tq;
			double r=sqrt(u.x*u.x+u.y*u.y);
			L s(P(R*u.x/r,R*u.y/r),P(u.x*3000, u.y*3000));
			while(!q.empty())
			{
				UFO uf=q.top(); q.pop();
				C c = C(P(uf.x-uf.dx*T, uf.y-uf.dy*T), uf.r);
				if(intersectSC(s,c)) continue;
				
				tq.push(uf);
			}
			
			while(!tq.empty())
			{
				q.push(tq.top()); tq.pop();
			}
			
			T++;
		}
		
		cout << cnt << endl;
	}
}