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

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
typedef stringstream SS;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
SS ss;
#define debug ss
#endif

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n);i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<=(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};


int R,n;
double x[110],y[110];
int r[110],v[110];
int state[110];

int main() {
	IL{
		cin>>R>>n;
		if(R==0&&n==0)break;
		rep(i,n){
			cin>>x[i]>>y[i]>>r[i]>>v[i];
		}
		memset(state,0,sizeof(state));
		IL{
			rep(i,n){
				if(state[i]==0&&x[i]*x[i]+y[i]*y[i]<=R*R){
					state[i]=-1;
				}
			}
			bool go=false;
			int shoot;
			double dis;
			rep(i,n){
				if(state[i]!=0)continue;
				shoot=i;
				dis=x[i]*x[i]+y[i]*y[i];
				go=true;
				break;
			}
			if(!go)break;
			rep(i,n){
				if(state[i]!=0)continue;
				if(dis>x[i]*x[i]+y[i]*y[i]){
					shoot=i;
					dis=x[i]*x[i]+y[i]*y[i];
				}
			}
			double xx=x[shoot],yy=y[shoot];
			rep(i,n){
				if(state[i]!=0)continue;
				if(xx*x[i]<0)continue;
				if(yy*y[i]<0)continue;
				double xxx=xx*(xx*x[i]+yy*y[i])/(xx*xx+yy*yy);
				double yyy=yy*(xx*x[i]+yy*y[i])/(xx*xx+yy*yy);
				if((xxx-x[i])*(xxx-x[i])+(yyy-y[i])*(yyy-y[i])<=r[i])state[i]=1;
			}
			rep(i,n){
				if(state[i]!=0)continue;
				double abs=sqrt(x[i]*x[i]+y[i]*y[i]);
				if(abs<r[i]){
					x[i]=0;
					y[i]=0;
				}else{
					x[i]-=r[i]/abs*x[i];
					y[i]-=r[i]/abs*y[i];
				}
			}
		}
		int res=0;
		rep(i,n)if(state[i]==-1)++res;
		cout<<res<<endl;
	}
	return 0;
}