#include <cstdio>
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
using namespace std;

typedef complex<double> P;
typedef const P &rP;

#define EPS 1e-7

struct UFO{
	double dist, arg, r, v;
	bool alive;

	bool operator< (const UFO &u) const{
		return dist < u.dist;
	}
};

double dot(rP va, rP vb){
	return real(va) * real(vb) + imag(va) * imag(vb);
}

double cross(rP va, rP vb){
	return real(va) * imag(vb) - imag(va) * real(vb);
}

double distance_l_p(rP a, rP b, rP c){
	return abs(cross(b - a, c - a)) / abs(b - a);
}

double distance_hl_p(rP a, rP b, rP c){
	if( dot(b - a, c - a) <= 0.0 ) return abs(c - a);
	return distance_l_p(a, b, c);
}

bool dead(const UFO &u){
	return !u.alive;
}

int solve(double R, int n){
	P zero;

	vector<UFO> u;
	u.reserve(n);
	for(int i = 0; i < n; ++i){
		double x, y, r, v;
		scanf("%lf%lf%lf%lf", &x, &y, &r, &v);
		P z(x, y);
		u.push_back((UFO){abs(z), arg(z), r, v, true});
	}

	int ans = 0;
	while(!u.empty()){
		for(int i = 0; i < u.size(); ++i){
			u[i].dist -= u[i].v;
			if(u[i].alive && u[i].dist < R + EPS){
				++ans;
				u[i].alive = false;
			}
		}

		u.erase(remove_if(u.begin(), u.end(), dead), u.end());
		if(u.empty()) break;

		P target = polar(1.0, min_element(u.begin(), u.end())->arg);
		for(int i = 0; i < u.size(); ++i){
			P c = polar(u[i].dist, u[i].arg);
			if(distance_hl_p(zero, target, c) < u[i].r + EPS){
				u[i].alive = false;
			}
		}
	}

	return ans;
}

int main(){
	double R;
	int N;
	while(scanf("%lf%d", &R, &N), N){
		printf("%d\n", solve(R, N));
	}
}