#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

const long double EPS = 1e-8;
const int INF = 1001001001;

struct UFO
{
	int r, v;
	long double a, arg;
	bool alive;
	UFO() : alive(true) {}
};

int main()
{
	int R, n;
	while(scanf("%d%d", &R, &n), R){
		UFO ufo[100];
		rep(i, n){
			int x0, y0;
			scanf("%d%d%d%d", &x0, &y0, &ufo[i].r, &ufo[i].v);
			ufo[i].a = hypot((long double)x0, (long double)y0);
			ufo[i].arg = atan2((long double)y0, (long double)x0);
		}
		
		int cnt = 0;
		for(;;){
			int nearest = -1;
			rep(i, n){
				if(ufo[i].alive){
					ufo[i].a -= ufo[i].v;
					if(ufo[i].a < R+EPS){
						ufo[i].alive = false;
						++cnt;
					}
					else if(nearest==-1 || ufo[nearest].a > ufo[i].a)
						nearest = i;
				}
			}
			if(nearest == -1)
				break;

			long double arg = ufo[nearest].arg;
			rep(i, n){
				if(!ufo[i].alive)
					continue;
				if(ufo[i].r+EPS > ufo[i].a)
					ufo[i].alive = false;
				else{
					long double diff = abs(arg - ufo[i].arg);
					if(diff > M_PI) diff = 2.0*M_PI - diff;
					if(diff > M_PI/2.0)
						continue;
					long double d = ufo[i].a*sin(diff);
					if(d < ufo[i].r+EPS)
						ufo[i].alive = false;
				}
			}
		}
		printf("%d\n", cnt);
	}
	return 0;
}