// 2011/08/01 Tazoe

#include <iostream>
#include <cmath>
using namespace std;

struct ufo{
	int x;
	int y;
	int r;
	int v;

	int sta;
	double dis;
};

int main()
{
	while(true){
		int R, N;
		cin >> R >> N;
		if(R==0&&N==0)
			break;

		struct ufo U[100];
		for(int i=0; i<N; i++){
			cin >> U[i].x >> U[i].y >> U[i].r >> U[i].v;

			U[i].sta = 0;
			U[i].dis = sqrt((double)(U[i].x*U[i].x+U[i].y*U[i].y));
		}
/*
		for(int i=0; i<N; i++)
			cout << U[i].sta << ' ' << U[i].dis << endl;
*/
		int n = 0;
		int m = 0;
		while(true){
			double min_dis = 1500.0;
			int    min_i   = -1;
			for(int i=0; i<N; i++){
				if(U[i].sta==0){
					U[i].dis -= (double)U[i].v;
					if(U[i].dis<=(double)R){
						U[i].sta = 1;
						n++;
					}
					else if(U[i].dis<min_dis){
						min_dis = U[i].dis;
						min_i   = i;
					}
				}
			}

			if(min_i!=-1){
				U[min_i].sta = 2;
				m++;

				for(int i=0; i<N; i++){
					if(U[i].sta==0){
						double cos1 = (double)(U[i].x*U[min_i].x+U[i].y*U[min_i].y)/(sqrt((double)(U[i].x*U[i].x+U[i].y*U[i].y))*sqrt((double)(U[min_i].x*U[min_i].x+U[min_i].y*U[min_i].y)));
						double cos2 = sqrt(1.0-(double)(U[i].r*U[i].r)/(U[i].dis*U[i].dis));
						if(cos1>=cos2){
							U[i].sta = 2;
							m++;
						}
					}
				}
			}
/*
			for(int i=0; i<N; i++)
				cout << U[i].sta << ' ' << U[i].dis << endl;
*/
			if(n+m==N)
				break;
		}

		cout << n << endl;
	}

	return 0;
}