#include<stdio.h>
#include<stdlib.h>
#include<math.h>
typedef struct{
	int r,v;
	double x,y;
	double d;
}t_ufo;
t_ufo ufo[100];
int r,n;
int i,j;
int f[100];
int ans;
int next;

int main(){
	while(1){
		scanf("%d %d",&r,&n);
		if(r==0&&n==0)return 0;
		ans=0;
		for(i=0;i<n;i++){
			scanf("%lf %lf %d %d",&ufo[i].x,&ufo[i].y,&ufo[i].r,&ufo[i].v);
			ufo[i].d=sqrt(ufo[i].x*ufo[i].x+ufo[i].y*ufo[i].y);
		}
		for(i=0;i<n;i++)f[i]=true;
		while(1){
			next=-1;
			for(i=0;i<n;i++)if(f[i]){
				ufo[i].x=ufo[i].x*(ufo[i].d-ufo[i].v)/ufo[i].d;
				ufo[i].y=ufo[i].y*(ufo[i].d-ufo[i].v)/ufo[i].d;
				ufo[i].d-=ufo[i].v;
				if(ufo[i].d<=r){
					f[i]=false;
					ans++;
				}
				if(f[i]&&(next==-1||ufo[i].d<ufo[next].d))next=i;
			}
			if(next==-1)break;
			double tm,tc;
			tm=ufo[next].y;
			tc=ufo[next].x;
			f[next]=false;
			for(i=0;i<n;i++)if(f[i]){
				if((tm*ufo[i].x-tc*ufo[i].y)*(tm*ufo[i].x-tc*ufo[i].y)<=(ufo[i].r)*(ufo[i].r)*(tm*tm+tc*tc))f[i]=false;
			}
		}
		printf("%d\n",ans);
	}
}