/**************** Geometrical Library ****************/

#include<cmath>
#include<vector>
#include<algorithm>

#define	EPS	1e-9

enum {CCW=1,CW=-1,ON=0};

#define	pb	push_back

using namespace std;

class Point{
public:
	double x,y;
	Point(){}
	Point(double xx,double yy):x(xx),y(yy){}
};

class Line:public vector<Point>{
public:
	Line(){}
	Line(const Point &a,const Point &b){
		pb(a),pb(b);
	}
};

class Segment:public Line{
public:
	Segment(){}
	Segment(const Point &a,const Point &b):Line(a,b){}
};

class Circle{
public:
	Point c;
	double r;
	Circle(){}
	Circle(const Point &cc,double rr):c(cc),r(rr){}
};

Point &operator +=(Point &a,const Point &b){
	a.x+=b.x,a.y+=b.y;
	return a;
}

Point &operator -=(Point &a,const Point &b){
	a.x-=b.x,a.y-=b.y;
	return a;
}

Point &operator *=(Point &a,double c){
	a.x*=c,a.y*=c;
	return a;
}

Point &operator /=(Point &a,double c){
	a.x/=c,a.y/=c;
	return a;
}

Point operator +(const Point &a,const Point &b){
	Point c=a;
	return c+=b;
}

Point operator -(const Point &a,const Point &b){
	Point c=a;
	return c-=b;
}

Point operator *(double c,const Point &a){
	Point b=a;
	return b*=c;
}

Point operator /(const Point &a,double c){
	Point b=a;
	return b/=c;
}

bool operator <(const Point &a,const Point &b){
	return (a.x==b.x)?(a.y<b.y):(a.x<b.x);
}

bool operator >(const Point &a,const Point &b){
	return b<a;
}

double dot(const Point &a,const Point &b){
	return a.x*b.x+a.y*b.y;
}

double cross(const Point &a,const Point &b){
	return a.x*b.y-a.y*b.x;
}

double norm2(const Point &a){
	return dot(a,a);
}

int ccw(const Point &a,Point b,Point c){
	b-=a,c-=a;
	double rotdir=cross(b,c);
	if(rotdir>EPS)		return CCW;
	if(rotdir<-EPS)		return CW;
	return ON;
}

inline void calc_abc(const Line &l,double &a,double &b,double &c){	// l : ax+by+c=0
	a=l[0].y-l[1].y;
	b=l[1].x-l[0].x;
	c=l[0].x*l[1].y-l[1].x*l[0].y;
}

Point perp_foot(const Point &p,const Line &l){
	double a,b,c;
	calc_abc(l,a,b,c);
	return p-(a*p.x+b*p.y+c)/(a*a+b*b)*Point(a,b);
}

bool intersect(const Line &l,const Line &m,Point *p=NULL){
	// this routine also returns true in case "M is on L", etc,.
	if(abs(cross(l[1]-l[0],m[1]-m[0]))>EPS
	|| abs(cross(l[1]-l[0],m[0]-l[0]))<EPS){
		if(p){
			double a1,b1,c1,a2,b2,c2;
			calc_abc(l,a1,b1,c1);
			calc_abc(m,a2,b2,c2);
			double det=a1*b2-a2*b1;
			if(abs(det)<EPS)	*p=l[0];	// l == m
			else{
				p->x=(b1*c2-b2*c1)/det;
				p->y=(a2*c1-a1*c2)/det;
			}
		}
		return true;
	}
	return false;
}

bool intersect(const Segment &s,const Segment &t,Point *p=NULL){
	if(max(s[0].x,s[1].x)<min(t[0].x,t[1].x)
	|| max(t[0].x,t[1].x)<min(s[0].x,s[1].x)
	|| max(s[0].y,s[1].y)<min(t[0].y,t[1].y)
	|| max(t[0].y,t[1].y)<min(s[0].y,s[1].y))	return false;

	if(ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1])<=0
	&& ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1])<=0){
		if(p){
			double a1,b1,c1,a2,b2,c2;
			calc_abc(s,a1,b1,c1);
			calc_abc(t,a2,b2,c2);
			double det=a1*b2-a2*b1;
			if(abs(det)<EPS){	// s is parallel to t
				Point q[3]={s[0],s[1],t[0]};
				for(int i=0;i<3;i++){
					if(dot(q[i]-s[0],q[i]-s[1])<EPS && dot(q[i]-t[0],q[i]-t[1])<EPS){
						*p=q[i];
						break;
					}
				}
			}
			else{
				p->x=(b1*c2-b2*c1)/det;
				p->y=(a2*c1-a1*c2)/det;
			}
		}
		return true;
	}
	return false;
}

int intersect(const Circle &c,const Line &l,Point *p=NULL,Point *q=NULL){
	Point m=perp_foot(c.c,l);
	double d2=norm2(c.c-m);
	if(c.r*c.r+EPS<d2)	return 0;
	else if(abs(c.r*c.r-d2)<EPS){
		if(p&&q)	*p=*q=m;
		return 1;
	}
	else{
		if(p&&q){
			Point v;
			double n0=norm2(l[0]-m),n1=norm2(l[1]-m);
			if(n0<n1)	v=l[1]-m,n0=n1;
			else		v=l[0]-m;
			v*=sqrt((c.r*c.r-d2)/n0);
			*p=m+v,*q=m-v;
		}
		return 2;
	}
}

int intersect(const Circle &c,const Segment &s,Point *p=NULL,Point *q=NULL){
	Point pp,qq;
	int n=intersect(c,Line(s[0],s[1]),&pp,&qq);
	if(n==0)	return 0;
	else if(n==1){
		if(dot(pp-s[0],pp-s[1])<EPS){
			if(p&&q)	*p=*q=pp;
			return 1;
		}
		return 0;
	}
	else{
		bool bp=(dot(pp-s[0],pp-s[1])<EPS);
		bool bq=(dot(qq-s[0],qq-s[1])<EPS);
		if(bp&&bq){
			if(p&&q)	*p=pp,*q=qq;
			return 2;
		}
		if(bp||bq){
			if(p&&q)	*p=(bp?pp:qq);
			return 1;
		}
		return 0;
	}
}

/**************** Library END ****************/

#include<cstdio>

using namespace std;

int main(){
	for(int R,n;scanf("%d%d",&R,&n),R;){
		static int v[500];
		static Circle ufo[500];
		static bool checked[500];
		for(int i=0;i<n;i++){
			scanf("%lf%lf%lf%d",&ufo[i].c.x,&ufo[i].c.y,&ufo[i].r,v+i);
			checked[i]=false;
		}

		int cnt=0,cnt_chk=0;
		for(int t=1;cnt_chk<n;t++){
			int target=-1;
			double dmin=1e30;
			// lock on & neighborhood test
			for(int i=0;i<n;i++){
				if(checked[i])	continue;
				double d=sqrt(norm2(ufo[i].c))-v[i]*t;
				if(d<R+EPS){	// ufo is in the neighborhood
					checked[i]=true;
					cnt_chk++;
					cnt++;
//printf("%d is in the neighborhood\n",i);
				}
				else{
					if(d<dmin){
						target=i;
						dmin=d;
					}
				}
			}
//printf("target = %d\n",target);
			// laser
			if(~target){
				Point unit=ufo[target].c/sqrt(norm2(ufo[target].c));
				Point ufopos=ufo[target].c-v[target]*t*unit;
				Segment laser(R*unit,1e9*ufopos);	// harf line
				for(int i=0;i<n;i++){
					if(checked[i])	continue;
					ufopos=ufo[i].c;
					ufopos-=v[i]*t*ufopos/sqrt(norm2(ufopos));
					Circle moved(ufopos,ufo[i].r);
//printf("ufo %d moved. (%6.2f,%6.2f)\n",i,moved.c.x,moved.c.y);
					if(intersect(moved,laser)){
						checked[i]=true;
						cnt_chk++;
//printf("%d shooted.\n",i);
					}
				}
			}
/*for(int i=0;i<n;i++)
printf("ufo[%2d].distance = %6.2f %s\n",i,
sqrt(norm2(ufo[i].c))-v[i]*t,checked[i]?"*":"");
puts("");
*/
		}

		printf("%d\n",cnt);
	}

	return 0;
}

Measured memory_bytes: 0