#include <iostream>
#include <math.h>
using namespace std;

struct ufo {
	double x,y,sx,sy,sl,r,v;
};
ufo uf[100];
int cnt,n,m,r,mn,f[100];
double s,hx1,hy1,hx2,hy2;

void move() {
	int i;
	double x,y,g;
	g=999999;
	for (i=0;i<n;i++) {
		if (f[i]==1) continue;
		x=uf[i].sx-uf[i].sx*uf[i].v*s/uf[i].sl;
		y=uf[i].sy-uf[i].sy*uf[i].v*s/uf[i].sl;
		if (x*x+y*y<=r*r || x*uf[i].sx<0 || y*uf[i].sy<0) { f[i]=1; cnt++; m--;}
		if (f[i]==0) { uf[i].x=x; uf[i].y=y;
		     if (x*x+y*y<g) { g=x*x+y*y; mn=i;}
		     } 
	    }
	  };

void hit(double x,double y,double r,double a) {
	int f=0;
	double c,z;
	if (a==9999) { a=0; z=x; x=y; y=z; f=1;}
	c=(2*x+2*a*y)*(2*x+2*a*y)-4*(1+a*a)*(y*y+x*x-r*r);
	if (c<0) { hx1=9999; return;}
	hx1=(2*x+2*a*y+sqrt(c))/(2*(1+a*a));
	hx2=(2*x+2*a*y-sqrt(c))/(2*(1+a*a));
	hy1=a*hx1; hy2=a*hx2;
	if (f==1) { hy1=hx1; hy2=hx2; hx1=hx2=0;}
} 

void attck() {
	int i;
	double a=0;
	if (uf[mn].x!=0) { a=uf[mn].y/uf[mn].x;} else a=9999;
	for (i=0;i<n;i++) {
		if (f[i]==1) continue;
		hit(uf[i].x,uf[i].y,uf[i].r,a);
		if (hx1==9999) continue;
		if (hx1*uf[mn].x>=0 && hy1*uf[mn].y>=0 && hx1*hx1+hy1*hy1>r*r) { f[i]=1; m--;}
		else if (hx2*uf[mn].x>=0 && hy2*uf[mn].y>=0 && hx2*hx2+hy2*hy2>r*r) { f[i]=1; m--;}
	}
	};

int main() {
    int i;
    while(cin >> r >> n) {
		if (n==0) break;
		m=n; s=0; cnt=0;
		for (i=0;i<n;i++) {
			f[i]=0;
		    cin >> uf[i].sx >> uf[i].sy >> uf[i].r >> uf[i].v;
		    uf[i].sl=sqrt(uf[i].sx*uf[i].sx+uf[i].sy*uf[i].sy);
		    uf[i].x=uf[i].sx; uf[i].y=uf[i].sy;
		}
		while(m>0) {
			s+=1;
			move();
			attck();
			}
		cout << cnt << endl;
	} 
	return 0;
}