#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 27;
const double EPS = 1e-12;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)

int R;
double x[200], y[200], r[200], v[200];
double dis[200];
bool used[200];

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

xy_t projection(const line &l, const xy_t &p){
	double t = dot(l.second - l.first, p - l.first) / norm(l.second - l.first);
	return l.first + t * (l.second - l.first);
}

bool intersectSP(const line &l, const xy_t &p){
	return abs(l.first - p) + abs(l.second - p) - abs(l.second - l.first) < EPS;
}

double distanceSP(const line &l, const xy_t &p){
	xy_t r = projection(l, p);
	if(intersectSP(l, r)) return abs(r - p);
	else return min(abs(l.first - p), abs(l.second - p));
}
int main(){
	int n, cnt;
	while(cin >> R >> n && (R || n)){
		cnt = 0;
		memset(used, false, sizeof(used));

		rep(i, n){
			cin >> x[i] >> y[i] >> r[i] >> v[i];
			dis[i] = sqrt((double)x[i]*x[i]+y[i]*y[i]);
		}

		rep(i, n){

			rep(j, n){
				if(used[j]) continue;
				dis[j] -= v[j];
				double ang = atan2(y[j], x[j]);
				y[j] -= v[j] * sin(ang);
				x[j] -= v[j] * cos(ang);
//				cout << j << " " <<  "( " << x[j] << ", " << y[j] << ")" << endl;
			}
//			cout << cnt << endl;

			rep(j, n){
				if(!used[j]){
					if(dis[j] < R + EPS){
						cnt++;
						used[j] = true;
					}
				}
			}

			int id = 0;
			double best = 1e10;
			rep(j, n){
				if(!used[j] && dis[j] < best){
					best = dis[j];
					id = j;
				}
			}

			double ang = atan2(y[id], x[id]);
			line l = line(xy_t(R * cos(ang), R*sin(ang)), xy_t(cos(ang), sin(ang)) * 1e10);
			
			rep(j, n){
				if(!used[j] && distanceSP(l, xy_t(x[j], y[j])) < r[j]){
					used[j] = true;
				}
			}
		}
		cout << cnt << endl;
	}
	return 0;
}