#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;

#define EPS 1e-9

struct ufo {
	double x, y;
	double r, v;

	ufo() {}
	ufo(double x_, double y_, double r_, double v_) {
		x = x_; y = y_; r = r_; v = v_;
	}

	bool operator<(const ufo & obj) const {
		return x*x + y*y < obj.x*obj.x + obj.y*obj.y;
	}

	bool operator==(const ufo & obj) const {
		return x==obj.x && y==obj.y && r==obj.r && v==obj.v;
	}
};

int main() {
	int N, R;

	while(cin >> R >> N, R || N) {
		vector<ufo> u;
		for(int i = 0; i < N; i++) {
			double x, y, r, v;
			cin >> x >> y >> r >> v;
			u.push_back(ufo(x,y,r,v));
		}

		int ret = 0;
		int count = 0;
		while(!u.empty()) {
			for(int i = 0; i < u.size(); i++) {
				double x, y;
				x = u[i].x; y = u[i].y;
				x -= u[i].v * cos(atan2(u[i].y, u[i].x));
				y -= u[i].v * sin(atan2(u[i].y, u[i].x));
				u[i].x = x; u[i].y = y;
			}

			sort(u.begin(), u.end());
			ufo aim(0,0,0,0);
			for(int i = 0; i < u.size(); i++) {
				if(u[i].x*u[i].x + u[i].y*u[i].y < R*R + EPS) {
					u.erase(u.begin() + i);
					i--;
					ret++;
				}
				else {
					if(aim == ufo(0,0,0,0)) {
						aim = u[i];
						u.erase(u.begin() + i);
						i--;
					}
					else {
						double theta = (atan2(aim.y, aim.x)- atan2(u[i].y, u[i].x));
						double d0, d1, d2;
						d0 = sqrt(u[i].x*u[i].x + u[i].y*u[i].y);
						d1 = d0 * cos(theta);
						d2 = d0 * sin(theta);

						if(d2 < u[i].r + EPS && d1 > 0) {
							double d3;
							d3 = sqrt(u[i].r*u[i].r - d2*d2);
							if(d1 + d3 > R && d1 + d3 >= sqrt(aim.x*aim.x + aim.y+aim.y)) {
								u.erase(u.begin() + i);
								i--;
							}
						}
					}
				}
			}
		}

		cout << ret << endl;
	}
}