#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <functional>
#include <queue>
#include <string>
#include <map>
#include <vector>

using namespace std;

struct ufo {
  double x, y, r, v, l;
  bool alive;
};

struct ufo ufos[100];

double sq(double x) {
  return x * x;
}

int main() {
  for (;;) {
    int R, N;
    cin >> R >> N;
    if (!R && !N) return 0;
    for (int i = 0; i < N; i++) {
      cin >> ufos[i].x >> ufos[i].y >> ufos[i].r >> ufos[i].v;
      ufos[i].l = sqrt(sq(ufos[i].x)+sq(ufos[i].y));
      ufos[i].x /= ufos[i].l;
      ufos[i].y /= ufos[i].l;
      ufos[i].alive = true;
    }
    int alive = N, result = 0;
    while (alive) {
      double m = 1500;
      int f = 0;
      for (int i = 0; i < N; i++)
        if (ufos[i].alive) {
          ufos[i].l -= ufos[i].v;
          if (ufos[i].l <= R) {
            ufos[i].alive = false;
            alive--;
            result++;
          } else if (ufos[i].l <= m) {
            m = ufos[i].l;
            f = i;
          }
        }
      if (!alive) break;
      for (int i = 0; i < N; i++)
        if (ufos[i].alive &&
            (ufos[i].l <= ufos[i].r ||
             (ufos[i].x*ufos[f].x+ufos[i].y*ufos[f].y >= 0 &&
              ufos[i].l*sqrt(abs(1-sq(ufos[i].x*ufos[f].x+ufos[i].y*ufos[f].y))) <= ufos[i].r))) {
          ufos[i].alive = false;
          alive--;
        }
    }
    cout << result << endl;
  }
}