#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
#include <complex>
typedef complex<double> Point;
struct Line : public vector<Point> {
  Line(Point a, Point b){
    push_back(a); push_back(b);
  }
  Point vector() const {
    return back() - front();
  }
};
double dot(Point a, Point b){
  return real(conj(a) * b);
}
double cross(Point a, Point b){
  return imag(conj(a) * b);
}
int ccw(Point a, Point b, Point c){
  b -= a; c -= a;
  if(cross(b, c) > EPS) return +1;
  if(cross(b, c) < -EPS) return -1;
  if(dot(b, c) < 0) return 2;
  if(norm(b) < norm(c)) return -2;
  return 0;
}
bool intersectSS(const Line& s, const Line& t){
  return ccw(s[0], s[1], t[0]) * ccw(s[0], s[1], t[1]) <= 0 && 
         ccw(t[0], t[1], s[0]) * ccw(t[0], t[1], s[1]) <= 0;
}
bool intersectSP(const Line& s, const Point& p){
  return ccw(s[0], s[1], p) == 0;
}
Point projection(const Line& l, const Point& p){
  double t = dot(p - l[0], l.vector()) / norm(l.vector());
  return l[0] + t * l.vector();
}
double distanceSP(const Line& s, const Point& p){
  const Point r = projection(s, p);
  if(intersectSP(s, r)) return abs(r - p);
  return min(abs(s[0] - p), abs(s[1] - p));
}
double distanceSS(const Line& s, const Line& t){
  if(intersectSS(s, t)) return 0;
  return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
             min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}
int main(){
  double R;
  int N;
  while(cin >> R >> N && (R != 0 || N != 0)){
    vector<Point> c(N);
    vector<double> r(N);
    vector<double> v(N);
    REP(i, N) cin >> c[i].real() >> c[i].imag() >> r[i] >> v[i];
    vector<bool> over(N);
    for(int t = 1; t <= 2 * N; t++){
      vector<Point> curr(N);
      REP(i, N) curr[i] = c[i] - min(1.0, v[i] * t / abs(c[i])) * c[i];
      int n_idx = -1;
      REP(i, N) if(!over[i] && abs(curr[i]) > R + EPS && (n_idx == -1 || abs(curr[n_idx]) > abs(curr[i]))) n_idx = i;
      if(n_idx == -1) break;
      Line laser(curr[n_idx] / abs(curr[n_idx]) * R, curr[n_idx] / abs(curr[n_idx]) * 1e6);
      REP(i, N) if(!over[i] && abs(curr[i]) > R + EPS && distanceSP(laser, curr[i]) < r[i] + EPS) over[i] = true;
    }
    int ans = 0;
    REP(i, N) if(!over[i]) ans ++;
    cout << ans << endl;
  }
  return 0;
}