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

typedef complex<double> P;

class ufo {
	public:
		P pos;
		int r;
		P v;
		bool av;
		bool in;
		ufo(P p, int r, P v):pos(p),r(r),v(v) {av = true; in = false;}
		void move();
};

class comp {
	public:
		bool operator() (const ufo& x, const ufo&y) const {
			return abs(x.pos) < abs(y.pos);
		}
};

vector<ufo> dt;
bool fava = true;
bool debug = false;
int R, N;

void ufo::move() {
	pos += v;
}

int ILimit (P x) {
	if (real(x) >= 0)
		if (imag(x) >= 0) return 1;
		else return 4;
	else
		if (imag(x) >= 0) return 2;
		else return 3;
}

bool IntersectCL(P p0, int r, P p1) {
	if (real(p1) == 0) return r*r >= real(p0)*real(p0);
	double a = imag(p1)/real(p1);
	return (2*a*real(p0)*imag(p0)+r*r) >= a*a*(real(p0)*real(p0)-imag(p0)*imag(p0));
}

void move() {
	for (int i=0; i<N; i++)
		dt[i].move();
}

void shot() {
	sort(dt.begin(), dt.end(), comp());
		if (debug) {
		cout << "debug\n";
		for (int i=0; i<N; i++) {
			if (dt[i].av)
			cout << '(' << real(dt[i].pos) << ',' << imag(dt[i].pos) << ')' << ',' << abs(dt[i].pos) << ',' << dt[i].in << endl;
		}
		}
	P v(0,0);
	bool f=true;
	int p=0;
	while(p<N) {
		if (dt[p].av && R < abs(dt[p].pos)) {
			f = false;
			dt[p].av = false;
			v = dt[p].pos;
			break;
		}
		p++;
	}
	if (f) { fava = false; return; }
	for (int i=0; i<N; i++) {
		if (R<abs(dt[i].pos)) {
			if (IntersectCL(dt[i].pos, dt[i].r, v) && ILimit(dt[i].pos)==ILimit(v))
				dt[i].av = false;
		} else  {
			 dt[i].in = true;
		}
	}
}

int main() {
	while(cin >> R >> N, (R||N)) {
		for (int i=0; i<N; i++) {
			int x, y, r, v;
			cin >> x >> y >> r >> v;
			P pos(x, y);
			P vr = - pos / abs(pos);
			vr *= (double)v;
			dt.push_back(ufo(pos, r, vr));
		}
		if (debug) {
		cout << "debug_m\n";
		for (int i=0; i<N; i++) {
			cout << '(' << real(dt[i].pos) << ',' << imag(dt[i].pos) << ')' << ',';
			cout << dt[i].r;
			cout << '(' << real(dt[i].v) << ',' << imag(dt[i].v) << ')' << '\n';
		}
		}
		while (fava) {
			move();
			shot();
		}
		int cnt = 0;
		for (int i=0; i<N; i++)
			if (dt[i].in) cnt++;
		cout << cnt << endl;
	}
	return 0;
}