#include <bits/stdc++.h>

using namespace std;

#define EPS 1e-10
#define equal(a,b) (fabs(a-b) < EPS)
#define lt(a,b) (a-b < -EPS)
#define le(a,b) (lt(a,b) || equal(a,b))
#define MAX_N 110
#define INF 1e9

struct Point{
  double x,y;

  Point(){}
  Point(double x,double y) : x(x),y(y) {}

  Point operator + (const Point &p)const{ return Point(x+p.x,y+p.y); }
  Point operator - (const Point &p)const{ return Point(x-p.x,y-p.y); }
  Point operator * (const double &k)const{ return Point(x*k,y*k); }
  Point operator / (const double &k)const{ return Point(x/k,y/k); }
  bool operator < (const Point &p)const{ return x != p.x ? x < p.x : y < p.y; }
};

double dot(const Point &a,const Point &b){ return a.x*b.x+a.y*b.y; }
double cross(const Point &a,const Point &b){ return a.x*b.y - b.x*a.y; }
double norm(const Point &p){ return dot(p,p); }
double abs(const Point &p){ return sqrt(norm(p)); }
double dist(const Point &a,const Point &b){
  return sqrt(pow(a.x-b.x,2) + pow(a.y-b.y,2));
}

typedef Point Vector;

struct Line{
  Point s,t;
  Line(){}
  Line(Point s,Point t) : s(s),t(t) {}
};

Point projection(const Line &l,const Point &p){
  Vector b = l.t-l.s;
  double t = dot(p-l.s,b)/norm(b);
  return l.s+b*t;
}

struct Circle{
  Point p;
  double r;
  Circle(){}
  Circle(Point p,double r) : p(p),r(r) {}
};

double distanceLP(const Line &l,const Point &p){
  return abs(p-projection(l,p));
}

bool isIntersectCL(const Circle &c,const Line &l){
  double d = distanceLP(l,c.p);
  if(lt(c.r,d)){ return false; }
  return true;
}

istream &operator >> (istream &is,Circle &c){
  return is >> c.p.x >> c.p.y >> c.r;
}

struct Data{
  Circle c;
  double v;
  Data(){}
  Data(Circle c,double v) : c(c), v(v) {}
};

int main(){
  double R;
  int N;
  while(true){
    cin >> R >> N;
    if(R == 0 && N == 0){ break; }
    vector<Data> UFO(N);
    double d[MAX_N];
    for(int i = 0 ; i < N ; i++){
      cin >> UFO[i].c >> UFO[i].v;
      d[i] = dist(Point(0,0),UFO[i].c.p);
    }
    int r = N;
    bool can[MAX_N];
    fill(can,can+N,true);
    for(int i = 0 ; i < N ; i++){
      int idx = -1;
      double mind = INF;
      for(int j = 0 ; j < N ; j++){
        d[j] -= UFO[j].v;
        if(lt(d[j],R)){
          can[j] = false;
        }
      }
      for(int j = 0 ; j < N ; j++){
        if(!can[j]){ continue; }
        if(lt(d[j],mind)){
          mind = d[j];
          idx = j;
        }
      }
      if(mind == INF){ break; }
      Line l(Point(0,0),UFO[idx].c.p);
      for(int j = 0 ; j < N ; j++){
        Circle c = UFO[j].c;
        if(can[j] && isIntersectCL(c,l)){
          can[j] = false;
          r--;
        }
      }
    }
    cout << r << endl;
  }
  return 0;
}