#include <complex>
#include <vector>
#include <cstdio>
#include <algorithm>
#include <cmath>
 
using namespace std;
 
typedef long double ldb;
typedef complex<ldb> P;
 
const ldb eps = 1e-8;
// math.hのM_PIでもOK?
const ldb pi = acos(-1);
// 誤差を考慮した比較 sig(a-b) のように使う
// ret<0 なら a<b, ret>0 なら a>b, ret=0 なら a=b
int sig(ldb a) {return (a<-eps)?-1:(a>eps)?1:0;}
// 誤差を考慮した比較
bool eq(ldb a,ldb b){return abs(a-b)<eps;}
// 内積
ldb dot(P a, P b) {
  return (a.real() * b.real() + a.imag() * b.imag());
}
// 外積
ldb cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
 
// 直線,線分 (半直線は未確認だけど線分で無限に長いものを作れば良さそう)
struct L {
  P a,b;
  L(){}
  L(P a,P b):a(a),b(b){}
  ldb len(){return abs(a-b);}
  P vec(){return b-a;}
};
 
// 線分abに対する点xの位置
enum CCW{FRONT = 1, RIGHT = 2, BACK = 4, LEFT = 8, ON = 16};
int ccw(L s, P p) {
  P a = s.vec();
  p -= s.a;
  ldb cr = cross(a, p);
  if (eq(cr, 0)) {
    if (sig(dot(a, p)) < 0) return BACK;
    if (sig(norm(a) - norm(p)) < 0) return FRONT;
    return ON;
  }
  return (cr > 0) ? LEFT : RIGHT;
}
 
// "線分"a と 点b の距離
double dLP2(L a,P b) {
  if ( dot(a.b-a.a, b-a.a) < eps ) return abs(b-a.a);
  if ( dot(a.a-a.b, b-a.b) < eps ) return abs(b-a.b);
  return abs(cross(a.b-a.a, b-a.a)) / abs(a.b-a.a);
}
 
int main(void)
{
  int n;
  ldb r;
  int done[111];
  ldb x[111],y[111],s[111],v[111];
  ldb vx[111],vy[111];
  for(;;) {
    scanf("%Lf%d",&r,&n); if( r+n == 0 ) break;
    for( int i = 0; i < n; i++ ) {
      scanf("%Lf%Lf%Lf%Lf",x+i,y+i,s+i,v+i);
      ldb ang = atan2(y[i],x[i]);
      vx[i] = -v[i]*cos(ang);
      vy[i] = -v[i]*sin(ang);
      done[i] = 0;
    }
    int res = 0;
    for(;;) {
      for( int i = 0; i < n; i++ ) {
        if( done[i] ) continue;
        ldb nx = x[i] + vx[i];
        ldb ny = y[i] + vy[i];
        ldb dist = dLP2(L(P(x[i],y[i]),P(nx,ny)),P(0,0));
        if( sig(dist-r) <= 0 ) {
          ++res;
          done[i] = 2;
        }
        x[i] = nx;
        y[i] = ny;
      }
      int mi = -1;
      for( int i = 0; i < n; i++ ) {
        if( done[i] ) continue;
        if( mi == -1 || sig(abs(P(x[i],y[i]))-abs(P(x[mi],y[mi]))) < 0 ) {
          mi = i;
        }
      }
      //printf("%d\n",mi);
      if( mi < 0 ) break;
      const ldb w = 1e7;
      P a = P(x[mi],y[mi]);
      a = a/abs(a);
      L l(a*r+a*eps,a*w);
      for( int i = 0; i < n; i++ ) {
        if( done[i] ) continue;
        ldb dist = dLP2(l,P(x[i],y[i]));
        //printf("%Lf %Lf %Lf\n",dist,x[i],y[i]);
        if( sig(dist-s[i]) <= 0 ){
          done[i] = 1;
        }
      }
      /*
      for( int i = 0; i < n; i++ ) {
        printf("%d:%c ",i,done[i]==0?'o':(done[i]==1?'x':'c'));
      }
      puts("");
      //*/
    }
    printf("%d\n",res);
  }
  return 0;
}