#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-5;
const int INF = 1001001001;

struct UFO
{
	int r, v;
	long double x, y, dist;
	long double sin, cos;
	bool alive;
	UFO() : alive(true) {}
};

int main()
{
	int R, n;
	while(scanf("%d%d", &R, &n), n){
		UFO ufo[100];
		rep(i, n){
			int x0, y0;
			scanf("%d%d%d%d", &x0, &y0, &ufo[i].r, &ufo[i].v);
			ufo[i].x = x0;
			ufo[i].y = y0;
			ufo[i].dist = hypot(ufo[i].x, ufo[i].y);
			if(ufo[i].dist > EPS){
				ufo[i].sin = ufo[i].y / ufo[i].dist;
				ufo[i].cos = ufo[i].x / ufo[i].dist;
			}
			else{
				ufo[i].sin = ufo[i].cos = 0.0;
			}
		}

		int cnt = 0;
		for(;;){
			int nearest = -1;
			rep(i, n){
				if(ufo[i].alive){
					ufo[i].x -= ufo[i].v * ufo[i].cos;
					ufo[i].y -= ufo[i].v * ufo[i].sin;
					ufo[i].dist -= ufo[i].v;
					if(ufo[i].dist < R+EPS){
						ufo[i].alive = false;
						++cnt;
					}
					else if(nearest==-1 || ufo[nearest].dist > ufo[i].dist)
						nearest = i;
				}
			}
			if(nearest == -1)
				break;

			long double s = ufo[nearest].sin;
			long double c = ufo[nearest].cos;
			rep(i, n){
				if(!ufo[i].alive)
					continue;
				
				if(ufo[i].r+EPS > ufo[i].dist)
					ufo[i].alive = false;
				else{
					if(c*ufo[i].cos + s*ufo[i].sin < 0.0)
						continue;
					long double d = ufo[i].dist*(s*ufo[i].cos - c*ufo[i].sin);
					if(d < ufo[i].r+EPS)
						ufo[i].alive = false;
				}
			}
		}
		printf("%d\n", cnt);
	}
	return 0;
}