#include<bits/stdc++.h>
using namespace std;
int main()
{
	while(true){
		double R;int N;
		double X[101];double Y[101];double R0[101];double V[101];double X0[101];double Y0[101];
		scanf("%lf%d",&R,&N);
		if(N==0)return 0;
		for(int i=0;i<N;i++){
			scanf("%lf%lf%lf%lf",&X[i],&Y[i],&R0[i],&V[i]);
			X0[i]=X[i];
			Y0[i]=Y[i];
		}
		int F[101];
		//-1:<R,1:survive,0:dead
		for(int i=0;i<N;i++){
			if(X[i]*X[i]+Y[i]*Y[i]<R*R)F[i]=-1;
			else F[i]=1;
		}
		//int sssss=10;
		while(true){
			bool FF=true;
			for(int i=0;i<N;i++){
				if(F[i]==1)FF=false;
			}
			if(FF)break;
			double mind=10000001;
			int mini;
			for(int i=0;i<N;i++){
				if(F[i]==1){
					double X1=X[i]-(X[i]*V[i])/sqrt(X[i]*X[i]+Y[i]*Y[i]);
					double Y1=Y[i]-(Y[i]*V[i])/sqrt(X[i]*X[i]+Y[i]*Y[i]);
					if(X1*X1+Y1*Y1<R*R)F[i]=-1;
					X[i]=X1;Y[i]=Y1;
					if(X1*X0[i]<=0&&Y1*Y0[i])F[i]=-1;
					
					else{
						if(mind>X[i]*X[i]+Y[i]*Y[i]){
							mind=X[i]*X[i]+Y[i]*Y[i];
							mini=i;
						}
					}
				}
			}
			
			if(mind==-1)continue;
			for(int i=0;i<N;i++){
				if(F[i]==1){
					double a=X[mini];double b=Y[mini];
					double D=(b*X[i]-a*Y[i])/sqrt(a*a+b*b);
					if(abs(D)<R0[i]&&a*X[i]>0){
						F[i]=0;
					}
				}
			}
			/*
			if(sssss>=0){
				sssss--;
				printf("%.4d %.4d\n",X[8],Y[8]);
				
			}*/
		}
		int cou=0;
		for(int i=0;i<N;i++){
			if(F[i]==-1)cou++;
		}
		printf("%d\n",cou);
	}
}