#include<iostream>
#include<complex>
#include<vector>
#include<cmath>
#define EPS 1e-8
using namespace std;

typedef complex<double> P;

class ufo{
public:
  P u;
  double r,v;
  ufo(void){}
  ufo(double x,double y, double z,double w){u.real()=x;u.imag()=y;r=z;v=w;}
};

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();}

bool on_line(P a,P b,P c){return (abs(a-c)+abs(c-b)<abs(a-b)+EPS);}

bool cross_l_c(P a,P b,ufo c){
  double dis = abs(cross(b-a,c.u-a))/abs(b-a);
  if(dis>c.r+EPS)return false;
  //cout << "{" << c.u.real() << " " << c.u.imag() << "}" << endl; 
  P n = b*P(0,1) + c.u;
  P u = b/abs(b);
  P cp = a + (b-a)*cross(n-c.u,c.u-a) / cross(n-c.u,b-a);
  //cout << "[" << cp.real() << " " << cp.imag() << "]" << endl;
  double len = sqrt(c.r*c.r-dis*dis);
  P p1 = cp+len*u,p2 = cp-len*u;
  /*
  cout << "[" << p1.real() << " " << p1.imag() << "]" << endl;
  cout << "[" << p2.real() << " " << p2.imag() << "]" << endl;
  cout << on_line(a,b,p1) << on_line(a,b,p2) << endl;
  */
  return (on_line(a,b,p1) || on_line(a,b,p2));
}

int main(){
  int n;
  double R,x,y,r,v;

  for(;;){
    cin >> R >> n;
    if(!R && !n)break;

    vector<ufo> ob;
    for(int i=0;i<n;i++){
      cin >> x >> y >> r >>v;
      ob.push_back(ufo(x,y,r,v));
    }

    int ans = 0;
    while(ob.size()){
      P m(10000,10000);
      for(int i=0;i<(int)ob.size();i++){
	P tmp = ob[i].u;
	ob[i].u.real() -= ob[i].v*dot(P(1,0),tmp)/abs(tmp);
	ob[i].u.imag() -= ob[i].v*cross(P(1,0),tmp)/abs(tmp);
      }
      //for(int i=0;i<(int)ob.size();i++)cout << ob[i].u.real() << " " << ob[i].u.imag() << endl;
      for(int i=0;i<(int)ob.size();i++){
	if(abs(ob[i].u) < R+EPS){
	  ans++;
	  ob.erase(ob.begin()+i--);
	}else if(abs(ob[i].u)<abs(m)+EPS)m = ob[i].u;
      }
      //cout << ob.size() << " " << m.real() << " " << m.imag() << endl;
      //cout << ob.size() << endl;
      m.real()*=2000;
      m.imag()*=2000;
      P l = m*R/abs(m);
      for(int i=0;i<(int)ob.size();i++){
	if(cross_l_c(l,m,ob[i]))ob.erase(ob.begin()+i--);
      }
      //cout << ob.size() << endl;
    }
    cout << ans << endl;
  }
}