#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

struct P{
	double x, y;
};

typedef P Vector;

struct UFO{
	P p;
	double r, v;
};

const P ORIGIN_P = {0, 0};
const double EPS = 1e-10;

double distance(P p1, P p2){
	double x_diff = p1.x - p2.x,
		y_diff = p1.y - p2.y;
	return sqrt(x_diff*x_diff + y_diff*y_diff);
}

double crossProduct(Vector v1, Vector v2){
	return v1.x*v2.y - v1.y*v2.x;
}

Vector createUnitVector(Vector v){
	double dist = distance(v, ORIGIN_P);
	return {v.x / dist, v.y / dist};
}

Vector operator*(const double k, const Vector v){
	return {k * v.x, k * v.y};
}

Vector operator+(const Vector v1, const Vector v2){
	return {v1.x+v2.x, v1.y+v2.y};
}

double abs(double d){
	return (d>0)?d:-d;
}

bool comp(const UFO& l_ufo, const UFO& r_ufo){
	return distance(l_ufo.p, ORIGIN_P) < distance(r_ufo.p, ORIGIN_P) + EPS;
}

int R, n;

void moveUFO(std::vector<UFO> &uv){//UFOの移動
	int uv_size = uv.size();
	for(int i=0;i<uv_size;i++){
		UFO &u = uv[i];
		Vector v = -u.v * createUnitVector(u.p);
		u.p = u.p + v;
	}
}

int countUFO(std::vector<UFO> &uv){//生存確定したUFOの数を返す
	int res = 0,
		uv_size = uv.size();
	std::vector<UFO> temp_uv;
	for(int i=0;i<uv_size;i++){
		if(distance(uv[i].p, ORIGIN_P) < R + EPS){
			res++;
		}else{
			temp_uv.push_back(uv[i]);
		}
	}
	uv = temp_uv;
	return res;
}

void shoot(std::vector<UFO> &uv){
	int uv_size = uv.size();
	std::vector<UFO> temp_uv;
	UFO attacked_u = uv[0];

	std::sort(uv.begin(), uv.end(), comp);
	for(int i=1;i<uv_size;i++){
		UFO u = uv[i];
		double A = distance(attacked_u.p, ORIGIN_P),
			c_product = crossProduct(attacked_u.p, u.p),
			dist = abs(c_product / A);
		if(dist < u.r + EPS){//破壊
				
		}else{//生き残る
			temp_uv.push_back(u);
		}
	}

	uv = temp_uv;
}

int main(){
	while(std::cin >> R >> n, R){
		std::vector<UFO> uv;
		for(int i=0;i<n;i++){
			UFO u;
			std::cin >> u.p.x >> u.p.y >> u.r >> u.v;
			uv.push_back(u);
		}

		std::sort(uv.begin(), uv.end(), comp);

		int res = 0;//生き残ったUFO
		while(!uv.empty()){
			res += countUFO(uv);
			moveUFO(uv);
			res += countUFO(uv);
			shoot(uv);
		}

		std::cout << res << std::endl;
	}
}