#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>

using namespace std;

const double INF = 10000.0;
const double EPS = 1e-8;

typedef complex<double> Point;

struct Segment{
  Point p1, p2;
};

typedef Segment Line;



Point point[100];
int R, N, r[100], v[100], rem;
bool lost[100];

double kabs(const double a){
  return a>=0 ? a : -a;
}

int getCrossPoint(Point& p1, Point& p2, const Line& li, double r, Point o = Point(0, 0)){
  double a = (li.p2.imag()-li.p1.imag())/(li.p2.real()-li.p1.real());
  double b = -1.0;
  double c = -a*li.p1.real()+li.p1.imag();
   
  c = a*o.real() + b*o.imag() + c;
 
  const double aabb = a*a + b*b;
  const double ac = a*c;
  const double bc = b*c;
  const double D1 = ac*ac - aabb * (c*c - b*b*r*r);
  const double D2 = bc*bc - aabb * (c*c - a*a*r*r);
 
  if(D1 < 0 || D2 < 0) return 0;
 
  int ret;
 
  if(D1 == 0 && D2 == 0) ret = 1;
  else ret = 2;
   
  if(kabs(b) >= kabs(a)){      
    p1.real() = (-ac + sqrt(D1)) / aabb;
    p1.imag() = -(a*p1.real() + c) / b;
    p2.real() = (-ac - sqrt(D1)) / aabb;
    p2.imag() = -(a*p2.real() + c) / b;
  }else{
    p1.imag() = (-bc + sqrt(D2)) / aabb;
    p1.real() = -(b*p1.imag() + c) / a;
    p2.imag() = (-bc - sqrt(D2)) / aabb;
    p2.real() = -(b*p2.imag() + c) / a;
  }
   
  p1.real() += o.real();  p1.imag() += o.imag();
  p2.real() += o.real();  p2.imag() += o.imag();
   
  return ret;
}


double dist(Point a, Point b = Point(0, 0)){
  return abs(a-b);
}

double dist(int time, int n){
  return dist(point[n])-v[n]*time;
}

void shoot(int n){
  Point p1, p2;
  Line li = {Point(0, 0), point[n]};
  for(int i=0;i<N;i++){
    if(lost[i]) continue;
    int num = getCrossPoint(p1, p2, li, R);
    if(num >= 1){
      if(abs(p1-Point(0, 0)) > EPS+R){
        lost[i] = true;
        --rem;
        continue;
      }
      if(num == 2){
        if(abs(p2-Point(0, 0)) > EPS+R){
          lost[i] = true;
          --rem;
        }
      }
    }
  }
}

int solve(){
  int res = 0;
  rem = N;
  fill(lost, lost+N, false);
  for(int t=0;rem>0;t++){
    double valm = INF;
    int idx;
    for(int i=0;i<N;i++){
      if(lost[i]) continue;
      double tmp = dist(t, i);
      if(tmp < R+EPS){
        lost[i] = true;
        ++res;
        --rem;
        continue;
      }
      if(valm > tmp){
        idx = i;
        valm = tmp;
      }
    }
    shoot(idx);
    lost[idx] = true;
    --rem;
  }
  return res;
}

main(){
  while(cin >> R >> N && (R|N)){
    for(int i=0;i<N;++i){
      cin >> point[i].real() >> point[i].imag() >> r[i] >> v[i];
    }
    cout << solve() << endl;
  }
  return 0;
}