#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<complex>

using namespace std;
typedef complex<double> P;
const double PI = acos(-1.0);
const double EPS = 1e-10;

inline double dot(P a, P b) {return real( conj(a)*b);}
inline double cross(P a, P b) {return imag( conj(a)*b);}
inline double sq(double x) {return x * x;}

#define REP(i,n) for(int i=0;i<(int)(n);++i)

struct C : public P {
  double r;
  C() {}
  C(const P &p,double r):P(p),r(r){}
};

struct UFO {
  C c;
  int v;
  bool alive;

  void move() {
    if (!alive) return;
    if (norm(c) < 1) return;
    double d = v / abs(c);
    if (d > 1.0) d = 1.0;
    c *= (1.0 - d);
  }
};

double DistanceSP(P a, P b, P c) {
  if ( dot(b-a, c-a) < EPS ) return abs(c-a); // c a--b
  if ( dot(a-b, c-b) < EPS ) return abs(c-b); // a--b c
  return abs(cross(b-a, c-a)) / abs(b-a);
}

int main() {
  for (int N, R; scanf("%d%d", &R, &N), (N || R); ) {
      vector<UFO> ufo;
      REP(i, N) {
          int x, y, r, v; scanf("%d%d%d%d",&x, &y, &r, &v);
          ufo.push_back( (UFO){ C(P(x, y), r), v, 1} );
      }

      for (;;) {
          REP(i, N) ufo[i].move();
          int tget = -1;
          double best = 0;
          REP(i, N) {
              if (ufo[i].alive && norm(ufo[i].c) > R * R + EPS) {
                  if (tget == -1 || best > norm(ufo[i].c)) {
                      tget = i;
                      best = norm(ufo[i].c);
                  }

              }
          }
          if (tget == -1) break;

          P o(0, 0);
          P t = ufo[tget].c;
          t *= 10000;

          REP(i, N) {
              if (ufo[i].alive && norm(ufo[i].c) > R * R + EPS) {
                  if (DistanceSP(o, t, ufo[i].c) <= ufo[i].c.r + EPS) {
                      ufo[i].alive = false;
                  }
              }
          }
      }
      int ans = 0;
      REP(i, N) if (ufo[i].alive) ++ans;
      cout << ans << endl;
  }
  return 0;
}