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

typedef complex<double> P;

#define INF 999999999
#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)

//àÏ
double dot(P a, P b){
	return (a.real() * b.real() + a.imag() * b.imag());
}

//OÏ
double cross(P a,P b){
	return (a.real() * b.imag() - a.imag() * b.real());
}

//üªabÆ_cÌ£
double distance_ls_p(P a, P b, P c) {
  if ( dot(b-a, c-a) < EPS ) return abs(c-a);
  if ( dot(a-b, c-b) < EPS ) return abs(c-b);
  return abs(cross(b-a, c-a)) / abs(b-a);
}

//üªabãÉ_cª é©
int is_point_on_line(P a, P b, P c) {
	return EQ( cross(b-a, c-a), 0.0 ) &&
	       (dot(b-a, c-a) > -EPS) &&
	       (dot(a-b, c-b) > -EPS);
}

//pÌÚ®ãÌÊuðßé
P move(P p,double v){
	P b = -p / abs(-p); //-p ÌPÊxNg
	return p + b * v;
}

int main(void){
	int n;
	double R;

	while(cin>>R>>n && (R||n)){
		int ans = 0;
		vector<P> p(n);
		vector<double> r(n),v(n);

		for(int i=0;i<n;i++){
			cin>>p[i].real()>>p[i].imag()>>r[i]>>v[i];
		}

		while(p.size() != 0){
			int minIdx = -1;
			double minDist = INF;

			for(int i=0;i<p.size();i++){
				//r[ª ½çÈ¢êÈçJEg
				if(abs(p[i]) < R + EPS){
					ans++;
					p.erase(p.begin()+i);
					r.erase(r.begin()+i);
					v.erase(v.begin()+i);
					i--;
					continue;
				}

				P aft = move(p[i],v[i]);
				double dist = abs(aft);

				//(0,0)ðÊßµÄµÜ¤©,¼aRÌÍÍàÈçJEg
				if(is_point_on_line(p[i],aft,P(0,0)) || dist < R + EPS){
					ans++;
					p.erase(p.begin()+i);
					r.erase(r.begin()+i);
					v.erase(v.begin()+i);
					i--;
					continue;
				}

				p[i] = aft;
				if(minDist > dist){
					minIdx = i;
					minDist = dist;
				}
			}

			if(minIdx == -1) break;

			P pp = p[minIdx];
			for(int i=0;i<p.size();i++){
				//´_©çppûüÖ·­LÑéüªÆ p[i] Ì£ª r[i] ÈºÈç ½é
				if(distance_ls_p(P(0,0),pp*1000000.0,p[i]) < r[i] + EPS){
					p.erase(p.begin()+i);
					r.erase(r.begin()+i);
					v.erase(v.begin()+i);
					i--;
				}
			}
		}

		cout<<ans<<endl;
	}

	return 0;
}