#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cmath>
using namespace std;


const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

class UFO{
public:
	double x;
	double y;
	int r;
	double vx;
	double vy;
	bool dead;
	bool invalid;
};

double dist_sq(UFO u){
	return (u.x*u.x+u.y*u.y);
}

UFO Rotate(UFO a, double theta){
	UFO u = a;
	u.x = a.x*cos(theta)-a.y*sin(theta);
	u.y = a.x*sin(theta)+a.y*cos(theta);
	return u;
}

double Cross(UFO a, UFO b){
	return a.x*b.y-b.x*a.y;
}

int main(){
	int R, N;
	while(cin >> R >> N, N){
		vector<UFO> ufo(N);

		for(int i = 0; i < N; i++){
			int v;
			cin >> ufo[i].x >> ufo[i].y >> ufo[i].r >> v;
			double theta = atan2(ufo[i].y, ufo[i].x)-PI;
			ufo[i].vx = v*cos(theta);
			ufo[i].vy = v*sin(theta);
		}

		while(true){
			double min = R*R;
			int target = -1;
//			puts("");
			for(int i = 0; i < N; i++){
//				printf("i:%d(x,y)=(%lf,%lf) dead = %d, invalid = %d\n", i, ufo[i].x, ufo[i].y, ufo[i].dead, ufo[i].invalid);
				if(!ufo[i].dead && !ufo[i].invalid){
					// 位置更新
					double p = ufo[i].x;
					double q = ufo[i].y;
					ufo[i].x += ufo[i].vx;
					ufo[i].y += ufo[i].vy;

					if(p*ufo[i].x < 0 || q*ufo[i].y < 0 || min >= dist_sq(ufo[i])){
						ufo[i].invalid = true;
					}else{
						// ターゲット選定
						if(target == -1){
							target = i;
						}
						else if(dist_sq(ufo[i]) < dist_sq(ufo[target])){
							target = i;
						}
					}
				}
			}

			// 続行判定
			if(target == -1){
				break;
			}

			// レーザー判定
			ufo[target].dead = true;
			for(int i = 0; i < N; i++){
				if(!ufo[i].dead && !ufo[i].invalid){
					if(Cross(Rotate(ufo[target], PI/2), ufo[i]) < 0){
						double cr = Cross(ufo[target], ufo[i]);
						if(cr*cr/dist_sq(ufo[target]) <= ufo[i].r*ufo[i].r){
							ufo[i].dead = true;
						}
					}else{
						if(dist_sq(ufo[i]) < ufo[i].r*ufo[i].r){
							ufo[i].dead = true;
						}
					}
				}
			}
		}

		int count = 0;
		for(int i = 0; i < N; i++){
			if(ufo[i].invalid){
				count++;
			}
		}
		cout << count << endl;
	}
	return 0;
}