#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 xr = x[n] * cos(zt) + y[n] * sin(zt);
      double yr = x[n] * -sin(zt) + y[n] * cos(zt);
      if (yr > r[n] - EPS || yr < EPS - r[n]) {
        ++it;
        continue;
      }
      double dk = sqrt(r[n] * r[n] - yr * yr);
      double k1 = xr + dk;
      if (k1 > R - EPS) {
        s.erase(it++);
      } else {
        ++it;
      }
    }
  }
  cout << ans << endl;
}

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