#include <iostream>
#include <set>
#include <cmath>
using namespace std;

typedef set<int> S;

const int NMAX = 500;
const double EPS = 1.0e-6;
const double INF = 1.0e10;

int N;
double R;
double x[NMAX];
double y[NMAX];
double r[NMAX];
double v[NMAX];

bool input() {
  cin >> R >> N;
  if (!R && !N) {
    return false;
  }
  for (int i = 0; i < N; ++i) {
    cin >> x[i] >> y[i] >> r[i] >> v[i];
  }
  return true;
}

void solve() {
  S s;
  for (int i = 0; i < N; ++i) {
    s.insert(i);
  }

  int ans = 0;
  while (!s.empty()) {
    int t = -1;
    double td = INF;
    for (S::iterator it = s.begin(); it != s.end();) {
      int n = *it;
      double d = sqrt(x[n] * x[n] + y[n] * y[n]);
      double nd = d - v[n];
      if (nd < R - EPS) {
        s.erase(it++);
        ++ans;
        continue;
      }
      if (td > nd) {
        td = nd;
        t = n;
      }
      x[n] *= nd / d;
      y[n] *= nd / d;
      ++it;
    }
    if (t == -1) {
      break;
    }
    double zt = atan2(y[t], x[t]);
    for (S::iterator it = s.begin(); it != s.end();) {
      int n = *it;
      double d2 = x[n] * x[n] + y[n] * y[n];
      double d = sqrt(d2);
      double z1 = atan2(y[n], x[n]);
      double z2 = atan2(r[n], sqrt(d2 - r[n] * r[n]));
      double zu = z1 + z2;
      double zl = z1 - z2;
      bool hit;
      if (d - r[n] < EPS) {
        hit = true;
      } else if (zu > M_PI) {
        hit = ((zl - EPS < zt && zt <= M_PI)
            || (-M_PI <= zt && zt < zu + EPS - 2 * M_PI));
      } else if (zl < -M_PI) {
        hit = ((zl + 2 * M_PI - EPS < zt && zt <= M_PI)
            || (-M_PI <= zt && zt < zu + EPS));
      } else {
        hit = (zl - EPS < zt && zt < zu + EPS);
      }
      if (hit) {
        s.erase(it++);
      } else {
        ++it;
      }
    }
  }
  cout << ans << endl;
}

int main() {
  while (input()) {
    solve();
  }
}