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

struct Point {
  double x, y;
  Point(double x=0, double y=0) : x(x), y(y) {}
  Point operator + (Point p) { return Point(x + p.x, y + p.y); }
  Point operator - (Point p) { return Point(x - p.x, y - p.y); }
  Point operator * (double a) { return Point(x * a, y * a); }
  Point operator / (double a) { return Point(x / a, y / a); }
};
typedef Point Vector;
struct Segment {
  Point p1, p2;
};
typedef Segment Line;

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; }
double getDistanceLP(Line s, Point p) {
  return fabs(cross(s.p2 - s.p1, p - s.p1))/abs(s.p2 - s.p1);
}

double getDistanceSP(Segment s, Point p) {
  if(dot(s.p2 - s.p1, p - s.p1) < 0.0) return abs(p - s.p1);
  if(dot(s.p1 - s.p2, p - s.p2) < 0.0) return abs(p - s.p2);
  return getDistanceLP(s, p);
}

const int N_MAX = 101;
struct Ufo {
  Point p;
  int r, v;
  double dist() { return abs(p); }
};

int R, N;
vector<Ufo> U;

void init() {
  U.clear();
}

int solve() {
  int ans = 0;
  while(!U.empty()) {
    double mini = -1;
    vector<Ufo>::iterator v;
    for(vector<Ufo>::iterator it = U.begin(); it != U.end(); ) {
      double D = it->dist();
      it->p.x -= it->p.x * it->v/D;
      it->p.y -= it->p.y * it->v/D;
      double D2 = it->dist();
      if(D <= it->v || D2 <= R) {
	ans++;
	it = U.erase(it);
      } else {
	if(mini == -1 || D2 < mini) {
	  mini = D2;
	  v = it;
	}
	it++;
      }
    }

    if(U.size() <= 1) break;

    Segment s;
    s.p1 = Point(0, 0);
    s.p2 = v->p * 10000;
    U.erase(v);

    for(vector<Ufo>::iterator it = U.begin(); it != U.end(); ) {
      if(getDistanceSP(s, it->p) <= it->r) {
	it = U.erase(it);
      } else {
	it++;
      }
    }
  }
  return ans;
}

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