#include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;
#define X real()
#define Y imag()
const double INF = 1e9;
const double EPS = 1e-10;

double dot(P a, P b){return a.X*b.X + a.Y*b.Y;}

double cross(P a, P b){return a.X*b.Y - a.Y*b.X;}

int ccw(P a, P b, P c){
  b -= a;
  c -= a;
  if(cross(b, c) > EPS) return 1;
  if(cross(b, c) < -EPS) return -1;
  if(dot(b, c) < -EPS) return -2;
  if(norm(c) > norm(b) + EPS) return 2;
  return 0;
}

P projection(P a, P b){
  return dot(a, b)/norm(b)*b;
}

bool is_attacked(C ufo, P d, int R){
  //return (abs(ufo.first - d*(double)R) < ufo.second + EPS) || (dot(ufo.first, d) > EPS && abs(projection(ufo.first, d)) > R - EPS && abs(cross(ufo.first, d)) < ufo.second + EPS);
  P D = d*(double)R, p = ufo.first - D;
  double dist;
  if(dot(p, D) > EPS) dist = abs(cross(ufo.first, d));
  else dist = abs(p);
  return dist < ufo.second + EPS;
}

int main(){
  int R, N;
  while(cin >> R >> N){
    if(R == 0 && N == 0) break;
    vector<C> UFO(N);
    vector<int> V(N);
    for(int i = 0; i < N; ++i){
      double x, y, r;
      cin >> x >> y >> r >> V[i];
      UFO[i] = C(P(x, y), r);
    }
    int c = 0, ans = 0, t = 0;
    vector<bool> U(N, false);
    while(c < N){
      ++t;
      double closest = INF;
      int id = -1;
      for(int i = 0; i < N; ++i){
        if(U[i]) continue;
        if(abs(UFO[i].first) - t*V[i] < closest){
          if(abs(UFO[i].first) - t*V[i] <= R + EPS){
            ++c;
            ++ans;
            U[i] = true;
          }else{
            closest = abs(UFO[i].first) - t*V[i];
            id = i;
          }
        }
      }
      if(id < 0) continue;
      P d = UFO[id].first;
      d /= abs(d);
      U[id] = true;
      ++c;
      for(int i = 0; i < N; ++i){
        if(U[i]) continue;
        C ufo;
        P p = UFO[i].first;
        ufo.first = (abs(p) - t*V[i])/abs(p)*p;
        ufo.second = UFO[i].second;
        if(is_attacked(UFO[i], d, R)){
          U[i] = true;
          ++c;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

