#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const double EPS = 1e-8;
const int INF = 1001001001;

typedef complex<double> P;
struct L : public vector<P> {
	L(const P &a, const P &b){
		push_back(a);
		push_back(b);
	}
};
double cross(const P& a, const P& b){
	return imag(conj(a)*b);
}
double dot(const P& a, const P& b){
	return real(conj(a)*b);
}
P projection(const L& l, const P& p){
	double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
	return l[0] + t*(l[0]-l[1]);
}
bool intersectSP(const L& s, const P& p){
	return abs(s[0]-p) + abs(s[1]-p) - abs(s[1]-s[0]) < EPS;
}
double distanceSP(const L& s, const P& p){
	const P r = projection(s, p);
	if(intersectSP(s, r)) return abs(r - p);
	return min(abs(s[0]-p), abs(s[1]-p));
}

struct UFO
{
	int r;
	P x, v;
	bool alive;
	UFO() : alive(true) {}
};

int main()
{
	double R;
	int n;
	while(scanf("%lf%d", &R, &n), n){
		UFO ufo[100];
		rep(i, n){
			double x0, y0, v;
			scanf("%lf%lf%d%lf", &x0, &y0, &ufo[i].r, &v);
			ufo[i].x = P(x0, y0);
			if(norm(ufo[i].x) > EPS)
				ufo[i].v = -v*ufo[i].x/abs(ufo[i].x);
			else
				ufo[i].v = P(0.0, 0.0);
		}
		
		int cnt = 0;
		for(;;){
			int nearest = -1;
			rep(i, n){
				if(ufo[i].alive){
					if(norm(ufo[i].x) > norm(ufo[i].v))
						ufo[i].x += ufo[i].v;
					else
						ufo[i].x = P(0.0, 0.0);
					
					if(abs(ufo[i].x) < R+EPS){
						ufo[i].alive = false;
						++cnt;
					}
					else if(nearest==-1 || norm(ufo[nearest].x) > norm(ufo[i].x))
						nearest = i;
				}
			}
			if(nearest == -1)
				break;
			
			L beam(R*ufo[nearest].x/abs(ufo[nearest].x), 10000.0*ufo[nearest].x);
			rep(i, n){
				if(!ufo[i].alive)
					continue;
				if(distanceSP(beam, ufo[i].x) < ufo[i].r + EPS){
					ufo[i].alive = false;
				}
			}
		}
		printf("%d\n", cnt);
	}
	return 0;
}