#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;


struct Point {
  double x, y;
};
typedef Point Vector;
double norm(Vector a) { return a.x*a.x + a.y*a.y; }
double abs(Vector a) { return sqrt(norm(a)); }
double dot(Vector a, Vector b) { return a.x*b.x + a.y*b.y; }
double cross(Vector a, Vector b) { return a.x*b.y - a.y*b.x; }

struct Ufo {
  Point p;
  int r, v;
};

int R;
vector<Ufo> U;

int solve() {
  int ans = 0;
  while(!U.empty()) {
    double mini = -1;
    vector<Ufo>::iterator mi;
    for(vector<Ufo>::iterator it = U.begin(); it != U.end(); ) {
      double d = abs(it->p);
      it->p.x = it->p.x * (d - it->v)/d;
      it->p.y = it->p.y * (d - it->v)/d;
      double d2 = abs(it->p);
      if(d <= it->v || d2 <= R) {
	ans++;
	it = U.erase(it);
      } else {
	if(mini == -1 || d2 < mini) {
	  mini = d2;
	  mi = it;
	}
	it++;
      }
    }
    if(mini == -1) break;
    Vector l = mi->p;
    U.erase(mi);
    for(vector<Ufo>::iterator it = U.begin(); it != U.end(); ) {
      bool hit = false;
      if(abs(it->p) <= it->r ||
	 (dot(l, it->p) > 0.0 && fabs(cross(l, it->p))/abs(l) <= it->r) ) {
	it = U.erase(it);
      } else {
	it++;
      }
    }
  }
  return ans;
}

main() {
  int n;
  while((cin >> R >> n) && (R || n)) {
    U.clear();
    for(int i = 0; i < n; i++) {
      Ufo u;
      cin >> u.p.x >> u.p.y >> u.r >> u.v;
      U.push_back(u);
    }
    cout << solve() << endl;
  }
}