#include <iostream>
#include <cmath>

using namespace std;

class Vector{
public:
	double x,y;

	double operator*( Vector a ){
		return x*a.x+y*a.y;
	}

	double scaler(){
		return sqrt( x*x + y*y );
	}

	void normalize(){
		double s = scaler();
		x /= s;
		y /= s;
	}
};

class Circle{
public:
	double rad;
	double r;
	double v;
	bool kill;
	bool isIn;
	Vector position;

	void set( double dx, double dy, double dr, double dv ){
		position.x = dx;
		position.y = dy;
		r = dr;
		v = dv;
		kill = false;
		isIn = false;
		rad = atan2( -position.y, -position.x );
	}

	void velocity(){
		position.x += v * cos( rad );
		position.y += v * sin( rad );
	}

	bool killOrIn(){
		return kill || isIn;
	}
};


int main(int argc, char const* argv[])
{
	int N;
	double R;
	Circle ufo[100];
	double min;
	int minNumber;

	while( cin >> R >> N && R != 0 && N != 0 )
	{
		for( int i = 0;i < N;i++ ){
			double x,y,r,v;
			cin >> x >> y >> r >> v;
			ufo[i].set( x, y, r, v );
		}

		for( int i = 0;i < N;i++ ){
			if( ufo[i].position.scaler() <= R ) ufo[i].isIn = true;
		}

		while( 1 ){
			for( int i = 0;i < N;i++ ){
				if( !ufo[i].killOrIn() ){
					ufo[i].velocity();
					if( ufo[i].position.scaler() <= R ) ufo[i].isIn = true;
				}
			}

			min = 10000000.0;
			minNumber = 0;
			for( int i = 0;i < N;i++ ){
				if( !ufo[i].killOrIn() && ufo[i].position.scaler() > R && ufo[i].position.scaler() < min ){
					min = ufo[i].position.scaler();
					minNumber = i;
				}
			}
			if( min == 10000000.0 ){
				int count = 0;

				for( int i = 0;i < N;i++ ){
					if( ufo[i].isIn ) count++;
				}

				cout << count << endl;
				break;
			}
			ufo[minNumber].kill = true;

			double dr;
			ufo[minNumber].position.normalize();
			for( int i = 0;i < N;i++ ){
				if( ufo[i].killOrIn() == false ){
					dr = ufo[i].position * ufo[i].position - ( ( ufo[i].position * ufo[minNumber].position ) * ( ufo[i].position * ufo[minNumber].position ) );
					if( dr < 0.0 ) continue;

					if( dr <= ufo[i].r * ufo[i].r ) ufo[i].kill = true;
				}
			}

		}

	}

	return 0;
}