#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);
typedef complex<double> P;
typedef complex<double> point;
namespace std {
	bool operator < (const P& a, const P& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(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);
}

struct L : public vector<P> {
	L(const P &a, const P &b) {
		push_back(a); push_back(b);
	}
};

typedef vector<P> G;
typedef vector<P> polygon;

struct C {
	P p; double r;
	C(const P &p, double r) : p(p), r(r) { }
};
//??????????????????
int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if (cross(b, c) > 0)   return +1;       // counter clockwise
	if (cross(b, c) < 0)   return -1;       // clockwise
	if (dot(b, c) < 0)     return +2;       // c--a--b on line
	if (norm(b) < norm(c)) return -2;       // a--b--c on line
	return 0;
}
bool intersectSP(const L &s, const P &p) {
	return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}
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]);
}
double distanceSP(const L &s, const P &p) {
	if(intersectSP(s, p)) return 0.0;
	const P r = projection(s, p);
	if (intersectSP(s, r)) return abs(r - p);
	return min(abs(s[0] - p), abs(s[1] - p));
}

//?????¢???rate???????????§???????°????
point spinPExtend(const point& p, double theta, double rate = 1.0){
	return p*complex<double>(rate*cos(theta),rate*sin(theta));
}

int main(){
	double r;
	int n;
	while(cin >> r>> n) {
		if((int)r == 0 && n == 0) break;
		C cir({0.0,0.0}, r);
		vector<C> cs;
		vector<double> v;
		vector<int> exist(n, 1);
		rep(i, n) {
			double x, y, _r, _v;
			cin >> x >> y >> _r >> _v;
			cs.pb({{x, y}, _r});
			v.pb(_v);
		}
		int ans = 0;
		while(1){
			int idx = -1;
			double mindist = INF, maxdist = 0.0;
			rep(i, n) if(exist[i] != 0) {
				double dist = abs(cs[i].p);
				if(dist < v[i] + EPS) {
					exist[i] = 0;
					ans++;
					continue;
				}
				cs[i].p *= (dist-v[i])/dist;
				dist = abs(cs[i].p);
				if(dist < r + EPS) {
					exist[i] = 0;
					ans++;
					continue;
				}
				if(dist < mindist - EPS) idx = i, mindist=dist;
				if(dist > maxdist + EPS) maxdist = dist;
			}
			if(idx == -1) break;
			L l(cs[idx].p * (maxdist + 500.0)/abs(cs[idx].p), cs[idx].p*r/abs(cs[idx].p));
			rep(i, n) if(exist[i] != 0) {
				if(distanceSP(l, cs[i].p) < cs[i].r+EPS) exist[i] = 0;
			}
		}
		//rep(i, n) if(exist[i]) ans++;
		rep(i, n) assert(exist[i] == 0);
		cout<<ans<<endl;
	}
}