#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;
		int il;
		ufo(P p, int r, P v, int il):pos(p),r(r),v(v),il(il) {
			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);
		}
};

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) {
	double dis = abs(real(p0)*real(p1)-imag(p0)*imag(p1)) / sqrt(real(p1)*real(p1)+imag(p1)*imag(p1));
	return dis <= r;
}

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

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

void shot() {
	sort(dt.begin(), dt.end(), comp());
	P v(0,0);
	bool f=true;
	int p=0;
	while(p<N) {
		if (dt[p].av)
			if ((R < abs(dt[p].pos) && (dt[p].il == ILimit(dt[p].pos)))) {
				f = false;
				dt[p].av = false;
				v = dt[p].pos;
				break;
			} else dt[p].in = true;
		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;
		}
	}
}

int main() {
	while(cin >> R >> N, (R||N)) {
		dt.clear();
		fava = true;
		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, ILimit(pos)));
		}
		while (fava) {
			move();
			shot();
		}
		int cnt = 0;
		for (int i=0; i<N; i++)
			if (dt[i].in) cnt++;
		cout << cnt << endl;
	}
	return 0;
}