#include<iostream>
#include<algorithm>
#include<cassert>
#include<map>
#include<vector>
#include<cmath>
#include<complex>
using namespace std;

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
#define N 100
#define DEAD false
#define ARRIVE true
#define eps 1e-10

typedef complex<double> P;

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

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

double distance_ls_p(P a,P b,P c,double r){
  if ( dot(b-a,c-a)<0)return r*2;
  else if ( dot(a-b,c-b)<0)return r*2;
  return abs(cross(b-a,c-a))/abs(b-a);
}


bool is_intersect_cl(P a,P b,P circle,double radius){
  bool flag1 = abs(a-circle)<=radius?1:0;
  bool flag2 = abs(b-circle)<=radius?1:0;
  
  if ( flag1 == true)return true;
  else if ( flag2 == true)return true;
  if (  distance_ls_p(a,b,circle,radius)<radius+eps)return true;
  return false;
}

class UFO{

public:
  P now;
  double r,v,theta,time;
  double vx,vy;
  bool flag;
  UFO(){};
  UFO(double tx,double ty,double tr,double tv,double R){
    flag = ARRIVE;
    now.real()=tx;
    now.imag()=ty;
    v=tv;
    r=tr;
    theta = arg(now);
    time = sqrt(tx*tx+ty*ty)-R;
    if (time < 0)flag=DEAD;
    else time/=v;
    vx=-cos(theta)*v;
    vy=-sin(theta)*v;    
  }

  void move(double t){    
    if (flag == DEAD){return;}
    now.real()+=vx;
    now.imag()+=vy;
    if ( time < t+eps){flag = DEAD;return ;}
  }

  bool crash_check(P a,P b){
    if ( flag == DEAD)return false;
    if ( is_intersect_cl(a,b,now,r)==true){
      flag = DEAD;
      return true;
    }
    return false;
  }
};


int solve(int n,UFO *data,double R){
  const double INF = 20000;
  int cnt=0;
  double time=1;
  while(true){
    double dist = 1000*1000;
    int minindex = -1;
    rep(i,n){
      data[i].move(time);
      if (data[i].flag == ARRIVE&& abs(data[i].now)<dist){
	dist=abs(data[i].now);
	minindex=i;
      }
    }
    if ( minindex == -1)break;
    
    P a,b,e;
    e = data[minindex].now/abs(data[minindex].now);
    a=e*R;
    b=e*INF;
    rep(i,n){
      if ( data[i].crash_check(a,b) == true)cnt++;
    }


    time+=1;
  }

  return n-cnt;
}

main(){
  double R;
  int n;
  while(cin>>R >> n && n){
    UFO data[n];
    rep(i,n){
      double x,y,r,v;
      cin>>x>>y>>r>>v;
      data[i]=UFO(x,y,r,v,R);
    }
    cout << solve(n,data,R) << endl;
  }

}