//45
#include<iostream>
#include<deque>
#include<cmath>
#include<complex>

using namespace std;

typedef complex<double> P;

int main(){
  for(int lr,n;cin>>lr>>n,lr|n;){
    int x[100],y[100],r[100],v[100];
    P p[100];
    for(int i=0;i<n;i++){
      cin>>x[i]>>y[i]>>r[i]>>v[i];
      p[i]=P(x[i],y[i]);
    }
    int nf=0;
    bool u[100]={};
    for(;;){
      int idx;
      double d=1<<30;
      for(int i=0;i<n;i++){
	if(!u[i]){
	  double ds=abs(p[i])-v[i];
	  p[i]=polar(ds,arg(p[i]));
	  if(ds<=lr){
	    nf++;
	    u[i]=true;
	  }else if(ds<d){
	    d=ds;
	    idx=i;
	  }
	}
      }
      if(d==1<<30)break;
      for(int i=0;i<n;i++){
	double ad=arg(p[i])-arg(p[idx]);
	u[i]|=cos(ad)>=0&&abs(p[i])*sin(fabs(ad))<=r[i]+1e-9;
      }
    }
    cout<<nf<<endl;
  }
  return 0;
}