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

//??????
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????§????????????????????±???????
P move(P p,double v){
  P b = -p / abs(-p); //-p ?????????????????????
  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++){
        //?????????????????????????????´?????????????????????
        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)???????????????????????????,??????R??????????????????????????????
        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++){
        P b = pp / abs(pp); //pp?????????????????????
        P o = b * R + b * EPS;
        //????????????R??¢????????´???????§??????¨??????,pp????????????????????????????????¨ p[i] ????????¢??? r[i] ??\??????????????????
        if(distance_ls_p(o,b*10000000.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;
}