#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
int R,N;
struct UFO{
  double r,k,v;
  double an;
  bool d;
  bool ok;
  bool o;
  UFO(){
    d = false;
    ok = false;
  }
  UFO(int x,int y,int r,int v){
    this->r = (double)r;
    this->k = sqrt(x*x+y*y);
    this->v = (double)v;
    this->an = atan((double)y/(double)x);
    d = false;
    ok=false;
  }
  void move(){
    if(ok || d) return;
    k -= v;
    if(k < R){
      k=0.0f;
      if(!d)
	ok=true;
    }
  }
  void kill(double a){
    if(k+r/2 >= (double)R && a==an){
      d=true;
    }
  }
};
main(){
  while(1){
    scanf("%d %d",&R,&N);
    if(R==0 && N==0) break;
    UFO u[111];
    for(int i=0;i<N;i++){
      int x,y,r,v;
      scanf("%d %d %d %d",&x,&y,&r,&v);
      u[i] = UFO(x,y,r,v);
    }

    int count;
    int indf=0;
    do{
      //      puts("MINI");
      count=0;
      int ind=indf;
      for(int i=0;i<N;i++)
	{
	  u[i].move();
	  if(!u[i].ok && !u[i].d){
	    if(u[ind].k > u[i].k) ind = i;
	  }
	  //  printf("k=%lf r=%lf v=%lf an=%lf 死:%d 侵:%d\n",u[i].k,u[i].r,u[i].v,u[i].an,u[i].d,u[i].ok);
	}

      double an = u[ind].an;
      //      printf("はっしゃ:%lf\n",an);
      for(int i=N-1;i>-1;i--){
	if(u[i].ok || u[i].d){
	  count++;
	  continue;
	}
	u[i].kill(an);
	if(!(u[i].ok || u[i].d)){
	  indf = i;
	}
      }
      
    }while( count < N );

    int res = 0;
    for(int i=0;i<N;i++)
      if(u[i].ok) res++;
    printf("%d\n",res);
  }
}